TransWikia.com

I am trying to code a discord bot that has a number game within it. For some reason it doesn't register author and contents as a command

Stack Overflow Asked by bingBong123 on December 23, 2021

This is my code, and everything works, but when i try to start it, it doesn’t work, stating: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module ‘discord.message’ has no attribute ‘author’

Code:

from discord import message
from discord.ext.commands import Bot
import time

#starting up
bot = Bot("!")

#varibles
starting_timer = 4
number_value = 1

@bot.command()
async def start(ctx):
    #starting up
        global starting_timer
        await ctx.send("Starting in 5 seconds!")
        time.sleep(1)

        starting_timer = 4

        while starting_timer > 0:
            await ctx.send(str(starting_timer))
            time.sleep(1)
            starting_timer = starting_timer - 1

        await ctx.send("GO!")
    #counting
        global number_value
        if message.author == bot.user:
            return

        while message.content.startswith(number_value):
            await ctx.send("Next!")
            number_value = number_value + 1

        else:
            await ctx.send("Oops, you failed!")




@bot.event
async def on_ready():
    print("Bot = ready")


bot.run("mytokenhere")

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP