-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
|
||
from nbb.models import get_message | ||
from nbb.config import get_config | ||
import discord | ||
from discord.ext import commands | ||
|
||
intents = discord.Intents.default() | ||
intents.message_content = True | ||
|
||
bot = commands.Bot(command_prefix="!", intents=intents) | ||
|
||
CONF = get_config() | ||
|
||
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None) or CONF["discord"]["token"] | ||
|
||
|
||
@bot.command( | ||
help="Get next bus at some stops.", | ||
brief="Get next bus at some stops.", | ||
) | ||
async def nbb(ctx, *args): | ||
"""Get next bus from the command line.""" | ||
if len(args) == 0: | ||
args = [None] | ||
await ctx.channel.send(get_message(CONF, args[0])) | ||
|
||
|
||
bot.run(DISCORD_TOKEN) |