Mercurial > codedump
comparison randomimageposter.py @ 19:bab0727f84f6
Add files via upload
committer: GitHub <noreply@github.com>
| author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
|---|---|
| date | Fri, 09 Apr 2021 21:43:22 -0400 |
| parents | |
| children | 358cad883bc3 |
comparison
equal
deleted
inserted
replaced
| 18:916bab9ae217 | 19:bab0727f84f6 |
|---|---|
| 1 import glob, os, random, discord | |
| 2 from discord.ext import commands | |
| 3 | |
| 4 client = commands.Bot(command_prefix = '!!') | |
| 5 | |
| 6 @client.event | |
| 7 async def on_ready(): | |
| 8 print("Ready!") | |
| 9 | |
| 10 @client.command() | |
| 11 async def random(ctx): | |
| 12 files = glob.glob("*.png") | |
| 13 files.extend(glob.glob("*.jpg")) | |
| 14 files.extend(glob.glob("*.gif")) | |
| 15 file = random.choice(files) | |
| 16 await ctx.send(file=discord.File(file)) | |
| 17 | |
| 18 client.run("PUT TOKEN HERE") |
