view randomimageposter.py @ 20:dfdb15d3caef

Update README.md committer: GitHub <noreply@github.com>
author Paper <37962225+mrpapersonic@users.noreply.github.com>
date Fri, 09 Apr 2021 21:49:32 -0400
parents bab0727f84f6
children 358cad883bc3
line wrap: on
line source

import glob, os, random, discord
from discord.ext import commands

client = commands.Bot(command_prefix = '!!')

@client.event
async def on_ready():
    print("Ready!")

@client.command()
async def random(ctx):
    files = glob.glob("*.png")
    files.extend(glob.glob("*.jpg"))
    files.extend(glob.glob("*.gif"))
    file = random.choice(files)
    await ctx.send(file=discord.File(file))

client.run("PUT TOKEN HERE")