pipedream icon indicating copy to clipboard operation
pipedream copied to clipboard

[TRIGGER] discord

Open dannyroosevelt opened this issue 2 years ago • 11 comments

Part of #3332

dannyroosevelt avatar Jul 06 '22 23:07 dannyroosevelt

Hi, I would like to on this one, you think. Can I give it a try?

gcamach0 avatar Jul 07 '22 09:07 gcamach0

Hi, I would like to on this one, you think. Can I give it a try?

Definitely! Please check out #3332 for context, and if you have any questions, our docs are a good place to get started, and the #contribute channel in our community Slack is the best place to ask for help.

dannyroosevelt avatar Jul 07 '22 16:07 dannyroosevelt

Thanks I'll let you know any updates

gcamach0 avatar Jul 07 '22 19:07 gcamach0

I was analyzing the code where you use the managed auth (discord, discord_bot, discord_webhook ) for discord sources or actions and from what I understood, the refactor its only needed in the sources that use the discord app prop because: a) discord_webhook is only used by actions. b) The sources that uses discord_bot already fetch the most recent 100 messages/guild members and emits them.

Doing some tests with New Message (the only source that uses the discord app prop) it seems to me that the creation of the webhook is probably already implemented by the discordApphook prop (I couldn't find anything in the documentation regarding the syntax of that prop).

The problem I find is that according to the discord documentation, in order to send messages from a channel to the discord API, I need to first create an application and then a bot to obtain a bot token (as you instructions indicate when you use the discord_bot app prop for managed auth).

I was considering trying to handle the authentication and the process to create the bot inside manually (not using the managed auth provided by you), but I don't feel like it's a good solution.

So I wanted to ask if you have any examples where a similar situation has arisen to see if I can try something similar.

Lastly, I noticed that the fetching of historical events on sources using discord_bot happens in the run method. Should I refactor that part so that functionality is inside the deploy hook?

gcamach0 avatar Jul 11 '22 03:07 gcamach0

Thanks for digging in @gcamach0! Very astute observations.

Are you able to fetch recent messages to the specified channel using the discord app prop?

dannyroosevelt avatar Jul 12 '22 05:07 dannyroosevelt

No because it doesn't prompt you to follow the steps to get the Bot Token which is needed to make request to the API like the discord_bot app prop does.

gcamach0 avatar Jul 12 '22 18:07 gcamach0

Hello @jcortes boss, as you have been the the major contributor of our discord app, would you mind helping @gcamach0 on his questions here above?


@gcamach0 may I ask if you have time to handle this, or do you want our component dev to take over?

vunguyenhung avatar Jul 29 '22 15:07 vunguyenhung

I'm moving this back to TODO for our component dev to take over as there's no response. @gcamach0 Kindly comment to this Github issue if you want to handle it again 🙏

vunguyenhung avatar Aug 01 '22 15:08 vunguyenhung

Having recently worked on Discord components, I believe @gcamach0 is correct. We'll need $auth to contain the "Bot Token" in order to make requests to the rest api.

michelle0927 avatar Aug 01 '22 16:08 michelle0927

I have time to work on this, but I don't know how can I help regarding the bot token situation.

gcamach0 avatar Aug 09 '22 21:08 gcamach0

The Discord Bot app now provides the bot token:

https://www.youtube.com/watch?v=UODtCjkqMQw

ctrlaltdylan avatar Sep 12 '22 15:09 ctrlaltdylan