roll command
commit d9a7748631d41d421a25ee103704c4f69f4a1430
3 changed files with 25 additions and 0 deletions
.gitignore ADDED
View File
| @@ -0,0 +1,2 @@ | ||
| 1 | +.env | |
| 2 | +__pycache__/ | |
bot.py ADDED
View File
| @@ -0,0 +1,22 @@ | ||
| 1 | +import os | |
| 2 | +import random | |
| 3 | + | |
| 4 | +import discord | |
| 5 | +from discord.ext import commands | |
| 6 | + | |
| 7 | +intents = discord.Intents.default() | |
| 8 | +intents.message_content = True | |
| 9 | +bot = commands.Bot(command_prefix="!", intents=intents) | |
| 10 | + | |
| 11 | + | |
| 12 | +@bot.event | |
| 13 | +async def on_ready(): | |
| 14 | + print(f"Logged in as {bot.user}") | |
| 15 | + | |
| 16 | + | |
| 17 | +@bot.command() | |
| 18 | +async def roll(ctx, sides: int = 6): | |
| 19 | + await ctx.send(f"🎲 {random.randint(1, sides)}") | |
| 20 | + | |
| 21 | + | |
| 22 | +bot.run(os.environ["DISCORD_TOKEN"]) | |
requirements.txt ADDED
View File
| @@ -0,0 +1 @@ | ||
| 1 | +discord.py==2.4.0 | |