Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Carlos
@nzlosh
Do you also happen to know if we can get err-backend-discord transferred from gbin's account to errbotio?
Christian
@Vaelor
@nzlosh Sure I will go ahead and rename it :)
Oh I just realized I can't rename it anymore :-D Guess someone else has to do that :)
Carlos
@nzlosh
The differences of being a contributor vs owner :)
Thanks for trying, I guess Sijis will sort it out when he's got some spare time.
Martin Flygenring
@zaughon
Hey. Since you're talking about the slackv3, are there any known issues with the v3 so far? I'm testing it out on a bot here, and i'm not receiving any messages at all on it. It sent a message to me when i made a code error, so something is working, but sending any kind of message to it, whether it's a command, tagged, tagged and a command, gives absolutely nothing in the errbot log. Not even in debug-mode.
Carlos
@nzlosh
@zaughon It works fine for me. People who have trouble getting the bot to respond or see no events usual don't have Slack settings correctly configured.
Martin Flygenring
@zaughon
Do we need to give it both Bot Token scopes and User Token Scopes? So far we've only given it bot token scopes, and almost everything. The only things we havn't given it so far is anything call, file, reminder related, and writing to chats it's not a member of
Carlos
@nzlosh
What type of bot token are you using? RTM, socket mode or Request URL?
Martin Flygenring
@zaughon
Socket mode:
15:28:40 INFO errbot.backends.slackv3 Using Events API - Socket mode client.
Carlos
@nzlosh
What events are subscribed for "Subscribe to bot events"?
Martin Flygenring
@zaughon
None, we skipped over that part since it mentioned "at a URL you choose". But that's the missing part then? We need to add "message.im" and stuff to be able to receive private messages then i assume?
Martin Flygenring
@zaughon
Does it need a Request URL to send stuff to when you only want to add bot events? "Save changes" doesn't light up
Sijis Aviles
@sijis
@nzlosh @Vaelor I'll rename it this morning
1 reply
Carlos
@nzlosh
@zaughon If you're using socket mode, you don't need to provide a URL. That is for Request URL mode.
Thanks Sijis :thumbsup:
Martin Flygenring
@zaughon
@nzlosh Aha! Found it. Needed to enable socket mode in the slack app settings as well. Hadn't spotted that menu point. Now it works. Thanks! :)
What is the most optimal way to create a new message and send it to a specific user? Create a new Message and then change the frm and to, since send_message() requires a message, or is there a better way to build a message from scratch for Slack?
Carlos
@nzlosh
If you think the slack README could be improved, a PR would be most welcome ;)
Martin Flygenring
@zaughon
I'll see if i can come up with something. I'm still not 100% sure on the whole slack_rtm and all the ways slack works. We just switched to slack recently, and now i need to recreate our old xmpp bot on slack, so i need to learn how slack works as well.. much against my will :P
Carlos
@nzlosh
Yes, Slack made things overly complicated when they announced the Events API. They switch to a server -> client architecture (Request URL) which didn't please a lot of people who didn't want to punch holes in firewalls etc. They released Socket mode to incorporate event subscription with a client server architecture. RTM still works, but the intention to sunset it makes its days numbered. The slackv3 backend tries to make all this detail a little easier to handle for errbot users. Good luck with the transition from XMPP to Slack btw.
Martin Flygenring
@zaughon
"Good luck with the transition from XMPP to Slack btw." you make it sound like i'm in for a world of hurt :(
Sijis Aviles
@sijis
if you you've stock errbot plugin commands and nothing xmpp specific in the plugin itself, it should not be too bumpy. Some of the ACL stuff may need some tweaking.
Martin Flygenring
@zaughon
There's several reasons we're rewriting all of it instead of just rewriting the base parts to Slack. Merge 2 errbots into 1, get rid of html-scraping of websites used to process commands and other things. It's been planned for over a year, it just kept getting postponed, but with the move to Slack, now it needs to happen :)
Currently i'm just trying to figure out the best way to do things.. like sending a message to a specific user where you only know the username.
Creating a new Message() and then setting the .to and .frm manually doesn't seem that nice.. especially if you need to use username_to_userid() to iterate through all users to get their id. Is there a nicer way that i'm missing?
Sijis Aviles
@sijis
is the plugin sending a specific user a message if the botcmd is initiated from another channel or is it within the same channel?
Martin Flygenring
@zaughon
In general, the user that initiated the command will receive a message, but in some cases there will be other people that need to be notified as well
Sijis Aviles
@sijis
ahh gotcha. a quick hack, i can think of is create a slack group and have the plugin message the group. it should be easier that looping through a list of users.
and probably easier to manage long term.. you'd manage slack groups instead of constant plugin changes
Martin Flygenring
@zaughon
Yea, problem is it's used as a helpdesk. 1stlevel support create an issue, 2ndlevel claim it. Those 2 are the main people, but sometimes issues are handed off to other people, and then it needs to inform everyone. So it's not always the same static list of people. It constantly changes depending on which issue it is
Which means, if you create a group, your slack is gonna be crowed with random groups, which isn't nice
Sijis Aviles
@sijis
gotcha.
Its not something i've personally done, so i havne't run into this scenario
the other thought i had was create a helper function thats something like (not tested)
def get_uid(self, user):
    u = username_to_userid(user):
    return u
Carlos
@nzlosh
Something to be aware of with Slack, they removed the notion of username and switched to userid. userid's are guaranteed to be unique in Slack, but you can have duplicate usernames. This can become an issue when security or privacy is concerned. At the moment, if the slackv3 backend gets back multiple users for a single username it'll raise an exception.
Sijis Aviles
@sijis
i don't do anytihng like that, so it'd be new ground to me
Martin Flygenring
@zaughon
Yea, it's a bit of a special case, but so far on Pidgin/XMPP it has worked great for realtime communication where supporters need answers to questions fast because a customer was waiting on the other end.
@nzlosh Yea, atm i'm considering whether it'd be better to store the userid in whatever database we end up with, instead of the username.. It's probably nicer than having to iterate through all users every few-ish seconds
But just to confirm.. the main way to send an "unprovoked" message to someone, is to make a new Message instance, and then change the .frm and .to, and then use send_message() to send it?
Give that whirl and if it doesn't work, please raise an issue. we'd love to make sure all that works and is correct.
Martin Flygenring
@zaughon
Ah, i had completely forgotten about self.send
I was looking at https://github.com/errbotio/err-backend-slackv3/blob/main/slackv3.py#L656 and trying to figure out how to send a message using that.
I seem to remember we had some issues with self.send on xmpp not doing something we wanted, so we made our own send() using self._bot.conn.client.send_message() instead. I don't remember what it was though, it was 3-4 years ago i think :/
Sijis Aviles
@sijis
again. let us know if that does/doesn't work.
i have code like that in many places too, where something is done differently and not really remembering why.
Martin Flygenring
@zaughon
Yea.. if only there was an easy way to add comments to the code when you do changes like that, so future you would know why :P
Sijis Aviles
@sijis
hopefully the git blame gives something.
Sijis Aviles
@sijis
@nzlosh I just noticed your message about err-backend-discord. seems like you've taken the reigns on that too. i'm not opposed to it
Carlos
@nzlosh
OK great.
I don't think I'm the owner of the repository, so don't know if I can transfer it, I'll try.
Yeah, I'm not the owner, so it will require Guillaume to hand it over to the errbotio organisation.
Sijis Aviles
@sijis
I'll reach out to him and see if he's willing to move it