I am trying to make a discord bot to make random encounters for a dnd, Right now I have the code
import discord
import os
import random
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$desert'):
DesertList = ['charmander', 'charmeleon', 'charizard']
Desert = random.choice(DesertList)
await message.channel.send(Desert)
client.run("just trust me its the right ID")
What I am trying to do is send Desert (defined Desert = random.choice(DesertList)) but the bot doesn't send anything. I have tested if Desert has a value in the console in visual studio and it returns a random name. I was basing it off of something that works in discord where I type $hello in a channel and it replies Hello!
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello!')