samedi 9 mai 2020

Discord.py wont respond to my if statement

I am just beginning to learn how to code with python. I tried to make a simple truth or dare game code. But the bot is not able to provess the choice and use the if statements, i cannot figure why. Here is my code:

import discord
from discord.ext import commands
import random

bot = commands.Bot(command_prefix = "Z")

@bot.event
async def on_ready():
    print("Bot is running!")

@bot.command()
async def game(ctx):
    truth_items = [(list of truth questions)]
    dare_items = [(list of dare questions)]
    await ctx.send("please type t for truth and d for dare")
    async def on_message(message):
        if(message == "t"):
            await ctx.send(f"{random.choice(truth_items)}")
        if(message == "d"):
            await ctx.send(f"{random.choice(dare_items)}")

bot.run(my_token)

Aucun commentaire:

Enregistrer un commentaire