Skip to content

AttributeError in console, but correct message in chat #471

@bxrbeq

Description

@bxrbeq

Hi, i'm on version 2.10.0 and im getting the following error into the console:

    File "C:\Users\---\AppData\Local\Programs\Python\Python312\Lib\site-packages\twitchio\client.py", line 208, in wrapped
        await func(*args)
    File "c:\Users\---\Documents\coding\python\twitch-bot\bxrbeq-bot.py", line 207, in event_message
        user = message.author.name
               ^^^^^^^^^^^^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'name'

in

    async def event_message(self, message):
            global NICK, CLIENT_ID,TOKENTWITCH
            user = message.author.name
            message_content = message.content
            msg = message.channel
            if user != NICK:
                if ('hallo' in message_content.lower() or 'hi' in message_content.lower()):
                    await msg.send(f'Hallo {user}')

but the message in the chat still has the authors name in it:
Image

Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions