Reputation: 23
I am trying to make a twitch bot, but I seem to be unable to use bot.event
for some reason.
If I use @bot.command
, it works perfectly and sends a response in chat:
@bot.command(name='test')
async def test_command(ctx):
await ctx.send("this is a test response")
But if I use, @bot.event
I get no response, even though its supposed to print the name and content to the console:
@bot.event
async def event_ready(ctx):
print(ctx.author)
print(ctx.content)
await bot.handle_commands(ctx)
My set-up:
from twitchio.ext import commands
from twitchio.client import Client
bot = commands.Bot(
token='oauth:my_oath_key',
client_id='230bszhh7p16oneij97dv6qgvcspuv',
nick='robo',
prefix='!',
initial_channels=['the_mass_man'],
)
if __name__ == '__main__':
bot.run()
I don't understand what I am doing wrong, my code is directly from a tutorial and I haven't changed anything about it other than my token/id/channel.
Upvotes: 0
Views: 197