Chat bot seems to hang

Hi,

I’m making a simple chat bot to explore the Twitch API with Python and the TwitchIO library, but I’m running into some issue executing my bot. I setup the application through the developer portal, followed the Authorization code grant flow guide to get my code and access token, and validated that access token using the curl command.

All of that seems to be working well, but when I invoke the bot.run(), I don’t get a print out confirming my login and the program just seems to sit idle. I stepped through the code in the debugger and it never seems to schedule my bot events. Currently, the code is very simple:

bot = commands.Bot(
    token="TOKEN",
    prefix='!',
    initial_channels=['CHANNEL']
)

@bot.event
async def event_ready():
    print(f'Logged in as | {bot.nick}')

if __name__ == '__main__':
    bot.run()

I do see after the initial scheduling that my bot appears to login as the nick and user ID do populate, but it doesn’t ever seem to reach my login message event. I initially provided the scope as: chat:read+chat:edit+channel:moderate, could this be an issue related to scoping? Any help would be greatly appreciated!

@developmentjeffe

The issue here is that you have missed the parenthesis on the event decorator

@bot.event()
async def event_ready():
    print(f'Logged in as | {bot.nick}')

In future, you would be better off posting this question on the Discord server, that is linked in the docs and github, of TwitchIO.
We will be able to be provide more extensive help there and in a more timely fashion.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.