https://github.com/gabriel-milan/t2d
Seamless integration between Typer and Discord for CLI Discord bots
https://github.com/gabriel-milan/t2d
bot cli discord discord-bot python typer
Last synced: about 1 month ago
JSON representation
Seamless integration between Typer and Discord for CLI Discord bots
- Host: GitHub
- URL: https://github.com/gabriel-milan/t2d
- Owner: gabriel-milan
- License: gpl-3.0
- Created: 2021-10-24T13:41:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-17T00:39:14.000Z (over 4 years ago)
- Last Synced: 2025-10-24T12:46:00.433Z (8 months ago)
- Topics: bot, cli, discord, discord-bot, python, typer
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# t2d
`t2d` is a short for Typer-to-Discord. It implements a seamless integration between Typer and Discord.py for CLI Discord bots development.
## Installing
Just install the package using `pip install t2d`.
## How to use it?
Assume that you have a Typer app that looks something like this:
```py
import typer
app = typer.Typer()
@app.command()
def hello(name: str):
typer.echo(f"Hello {name}!")
@app.command()
def bye(name: str):
typer.echo(f"Bye {name}!")
```
All you have to do is:
```py
import t2d
bot = t2d.T2D(app)
bot.run(YOUR_DISCORD_BOT_TOKEN)
```
And that's it! Now you can use your Typer app in Discord! Default commands are:
```
!help Shows default help message for the bot
!t2d Runs Typer CLI app using T2D
!version Prints T2D version
```
Using the example above, you can do the following:
```
!t2d hello Gabriel -> Shows "Hello Gabriel!"
!t2d bye Gabriel -> Shows "Bye Gabriel!"
```
## Extending T2D
One can also extend T2D as it normally would using the `discord.ext.commands.Bot` API.