Hello, I am trying to create a discord bot using Beau Carnes’ discord.py bot tutorial
The thing is when I run this code:
import discord
import os
import random
from keep_alive import keep_alive
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.content.startswith('ub help'):
embedVar = discord.Embed(title="UltremeBot Commands", description="See all of UltremeBot's commands (add ub before any command)", color=0x2C2F33)
embedVar.add_field(name="joke", value="Laugh out Loud!", inline=False)
embedVar.add_field(name="Field2", value="hi2", inline=False)
await message.channel.send(embed=embedVar)
keep_alive()
client.run(os.getenv('TOKEN'))
it seems to be working just fine. But when I add a list and another command, it doesn’t work.
import discord
import os
import random
from keep_alive import keep_alive
joke = ['joke1', 'joke2', 'joke3']
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.content.startswith('ub help'):
embedVar = discord.Embed(title="UltremeBot Commands", description="See all of UltremeBot's commands (add ub before any command)", color=0x2C2F33)
embedVar.add_field(name="joke", value="Laugh out Loud!", inline=False)
embedVar.add_field(name="Field2", value="hi2", inline=False)
await message.channel.send(embed=embedVar)
@client.event
async def on_message(message):
if message.content.startswith('ub joke'):
embedVar = discord.Embed(title='Joke', description=(random.choice(joke)))
keep_alive()
client.run(os.getenv('TOKEN'))
Can someone pleaase help me with this. Thank You.