Get the username from senders of messages on the twitch chat

I have the function below to get all the text from the chat, I would also like to get the username of the user who sends the message for any message on chat.

what would be the best way to do this?

    def on_pubmsg(self, connection, event):
            chatText = self.string_to_list(event.arguments)
            print("searching for commands in chat: ", chatText)   
            command_indicator = '!'
            for text in chatText:
                if command_indicator in text:
                    if text[0] == command_indicator:
                        print("command founded!")

I founded the solution: username = event.source.nick

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