scrapinghub / slackbot

A chat bot for Slack (https://slack.com).
MIT License
1.26k stars 394 forks source link

Migrate from slacker to slack-sdk #228

Closed jacobtruman closed 2 years ago

jacobtruman commented 2 years ago

A newly created legacy bot token fails to authenticate using the older auth method used by the slacker module. The rtm.start method has also been deprecated, so migrated to rtm.connect. The slack-sdk module also provides blocks support.

Resolves #227. Resolves #210. Resolves #209.

amuraru commented 2 years ago

+1

amuraru commented 2 years ago

@jacobtruman this is promising. I tested it with my own bot and encountered an issue though:

the bot enters an infinite loop due to rtm websocket disconnect:

2021-12-23 19:41:11,009 - slackbot.slackclient - WARNING - reconnected to slack rtm websocket
2021-12-23 19:41:16,020 - slackbot.slackclient - WARNING - lost websocket connection, try to reconnect now

Should we look into using the RTMClient instead? https://slack.dev/python-slack-sdk/real_time_messaging.html#real-time-messaging-rtm

jacobtruman commented 2 years ago

@jacobtruman this is promising. I tested it with my own bot and encountered an issue though:

the bot enters an infinite loop due to rtm websocket disconnect:

2021-12-23 19:41:11,009 - slackbot.slackclient - WARNING - reconnected to slack rtm websocket
2021-12-23 19:41:16,020 - slackbot.slackclient - WARNING - lost websocket connection, try to reconnect now

Should we look into using the RTMClient instead? https://slack.dev/python-slack-sdk/real_time_messaging.html#real-time-messaging-rtm

@amuraru good catch - is this something easily duplicated, so that I can properly test it?

jacobtruman commented 2 years ago

@jacobtruman this is promising. I tested it with my own bot and encountered an issue though:

the bot enters an infinite loop due to rtm websocket disconnect:

2021-12-23 19:41:11,009 - slackbot.slackclient - WARNING - reconnected to slack rtm websocket
2021-12-23 19:41:16,020 - slackbot.slackclient - WARNING - lost websocket connection, try to reconnect now

Should we look into using the RTMClient instead? https://slack.dev/python-slack-sdk/real_time_messaging.html#real-time-messaging-rtm

@amuraru I was able to duplicate this issue and added a ping to the parse user and channel data methods to prevent websocket disconnect. I am looking into implementing using RTMClient, but it looks like it might be a pretty hefty rewrite - I still think it is a good idea and am still experimenting with it.

jacobtruman commented 2 years ago

closing in favor of #229 under feature branch