Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinysocks/modulartelebot
an extensible telegram bot
https://github.com/shinysocks/modulartelebot
Last synced: about 1 month ago
JSON representation
an extensible telegram bot
- Host: GitHub
- URL: https://github.com/shinysocks/modulartelebot
- Owner: shinysocks
- Created: 2024-05-03T05:59:43.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-05T20:09:21.000Z (8 months ago)
- Last Synced: 2024-05-06T18:51:22.879Z (8 months ago)
- Language: Java
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# modulartelebot
### an extensible telegram bot---
## Current Modules
* GitRatio (compare your git graph with your friends)
* Pirate (download songs from spotify)
* YTDL (download videos from youtube)
* Test (demonstrate module functionality)## Usage
create a telegram bot
* [obtain your bot token](https://core.telegram.org/bots/tutorial#obtain-your-bot-token)create a docker image
```
docker build -t modulartelebot-image .
```
create and run a container
```
docker run -d --name modulartelebot -e TELEGRAM_TOKEN='your_token_here' modulartelebot-image
```
monitor the container
```
docker logs -f modulartelebot
```## Contributing
*to contribute to this project just open a pull request!!*currently any new modules should extend the BotModule class which contains 4 important methods:
* addCommand() -> adds a command which the bot will listen for.
* update() -> called whenever the bot recieves a message containing the specified command
* init() -> called when the bot is started
* send(SendMessage | SendPhoto | SendVideo | SendAudio | SendDocument) -> sends specified content### Example usage from Test.java:
```
public class Test extends BotModule {
public Test(Bot bot) {
super(bot);
addCommand("!test");
}@Override
public void update(String message, String chatId) throws TelegramApiException {
send(new SendMessage(chatId, "testing"));
}@Override
public void init() {}
}
```## Credits
* [TelegramBots API](https://github.com/rubenlagus/TelegramBots)
* [spotify-downloader](https://github.com/spotDL/spotify-downloader)
* [youtube-dl](https://github.com/ytdl-org/youtube-dl)