sharkbound / PythonTwitchBotFramework

asynchronous twitchbot framework made in pure python
MIT License
100 stars 26 forks source link

Overriding Events not working properly. Duplicate print in console. #39

Closed mdsanima closed 3 years ago

mdsanima commented 3 years ago

Hi, when I run this

from twitchbot import BaseBot, Message
class MyCustomTwitchBot(BaseBot):
    async def on_privmsg_received(self, msg: Message):
        print(f'{msg.author} sent message {msg.content} to channel {msg.channel_name}')

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

console give me a duplicate messages like this

mdsubuntu(mdsubuntu): not working
mdsubuntu sent message not working to channel mdsubuntu

please give me a proper method to print only one message. thank you so much!

sharkbound commented 3 years ago

this is intended behavior, events on the bot are essentially a list of handler, so adding a new handle just calls that as well, in addition to the default handler

to fix this open configs/console_logging_config.json and change "log_privmsg": true, to "log_privmsg": false,

mdsanima commented 3 years ago

yes, this is works fine, thank you so much, I love this. Keep going and good luck.