errbotio / err-backend-discord

Backend for Discord for Errbot
GNU General Public License v3.0
23 stars 22 forks source link

self.send() channel + guild support 🗨️ #45

Closed GrantBirki closed 2 years ago

GrantBirki commented 3 years ago

self.send() channel + guild support

What is this?

A pull request to enable self.send() to publish messages directly to a Discord channel with an associated guild_id

Why is this?

Being able to send messages to a Discord channel with a corresponding guild_id is a feature myself and many other users can benefit from.

Since there are very frequent name clashes (ie. lots of channels with a #general) you need to associate the guild_id to prevent these clashes. This feature does exactly that and with ease.

Example:

self.send(
    self.build_identifier("#general@12345678901234567"),
    "hello world!"
)

Where #general is the channel and @12345678901234567 is the Discord guild_id to send the message to. "hello world!" is the message that will be delivered!

GrantBirki commented 3 years ago

Note: I have been using this exact code with my Discord bot and have detected no issues so far

nzlosh commented 2 years ago

OK, this sound good to me. Thank you for the contribution.