|
| 1 | +# Auto Send New Files Webhook |
| 2 | +Do you want to automatically send new files from a directory of your computer to a Discord Webhook? Well now you can with this code. Don't worry anymore about taking the time to search the file and sending it manually. This code will automatically do it for you. |
| 3 | + |
| 4 | +*Now Selfbot is available too.* |
| 5 | + |
| 6 | +## Official Releases |
| 7 | +You can download the last official release [here](https://github.com/Benjas333/AutoSendNewFilesWebhook/releases/tag/v1.0.0). |
| 8 | + |
| 9 | +*Disclaimer: I don't know if it works properly in other operating systems than Windows.* |
| 10 | + |
| 11 | +## Cloning repo |
| 12 | +### Getting Started |
| 13 | +[Python 3.12](https://www.python.org/downloads/) recommended. |
| 14 | + |
| 15 | +[Discord](https://discord.com/) lol. |
| 16 | + |
| 17 | +### Clone this project |
| 18 | +``` |
| 19 | +git clone https://github.com/Benjas333/AutoSendNewFilesWebhook |
| 20 | +cd AutoSendNewFilesWebhook |
| 21 | +``` |
| 22 | +### Install dependencies |
| 23 | +``` |
| 24 | +pip install -r requirements.txt |
| 25 | +``` |
| 26 | +### Configure the .env file |
| 27 | +- Change the content of `example.env`. |
| 28 | +- Rename it to `.env`. |
| 29 | +## Usage |
| 30 | +### Command line |
| 31 | +**`.env` file required.** |
| 32 | +#### Webhook |
| 33 | +``` |
| 34 | +python webhook.py |
| 35 | +``` |
| 36 | +#### Selfbot |
| 37 | +``` |
| 38 | +python selfbot.py |
| 39 | +``` |
| 40 | +To use the selfbot you must provide your account token in the `.env` file. |
| 41 | + |
| 42 | +`Ctrl + C` to stop the scripts. |
| 43 | +### Import |
| 44 | +#### Webhook |
| 45 | +```python |
| 46 | +# Import script |
| 47 | +import webhook |
| 48 | +from time import sleep |
| 49 | + |
| 50 | +webhook.webhook.url = "https://your.discord.webhook/url" # Set webhook url |
| 51 | +webhook.sendMessage("Hello, world!") # You can send simple messages |
| 52 | +while True: |
| 53 | + sleep(1) |
| 54 | + webhook.checkForNewFiles( |
| 55 | + directory="C:\Your\Directory\", |
| 56 | + extension="*", # '*' will check all files in the directory |
| 57 | + recursive=True, |
| 58 | + ) |
| 59 | + # This will check for new files every 1 second |
| 60 | +``` |
| 61 | +I have realized webhook importing method is trash. I will redo this probably making it a class. |
| 62 | +#### Selfbot |
| 63 | +```python |
| 64 | +# Import script |
| 65 | +from selfbot import Selfbot |
| 66 | + |
| 67 | +client = Selfbot( |
| 68 | + channel_id=1234567890 # the channel id where you want to send the files |
| 69 | + directory="C:\Your\Directory" |
| 70 | + extension="mp3" |
| 71 | + recursive=False, |
| 72 | +) |
| 73 | +client.run(token="YOUR TOKEN HERE") |
| 74 | +``` |
| 75 | +Way better than the webhook importing method lol (for now). |
| 76 | +#### If you want to use the .env file with the importing methods, you just need to make `import config` |
| 77 | +## TO DO |
| 78 | +- Find an optimized way to send big files quickly. |
| 79 | + |
| 80 | +## Changelog |
| 81 | +- Added [releases](https://github.com/Benjas333/AutoSendNewFilesWebhook/releases) for people not so familiar with programming in general. |
| 82 | + |
| 83 | +## Contributing |
| 84 | +Any contribution would be appreciated. |
0 commit comments