-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Setup discord bot #1
base: main
Are you sure you want to change the base?
Conversation
Hey @ChaituVR could you have a look at this PR? Refactoring of the client can be done in a separate PR 🙏 |
router.post('/event-to-subscribers', async (req, res) => { | ||
const event: string = req.body.event || ''; | ||
const proposalId: string = req.body.proposalId || ''; | ||
|
||
try { | ||
await sendEventToDiscordSubscribers(event, proposalId); | ||
return res.json({ success: true }); | ||
} catch (e) { | ||
return res.json({ error: e }); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We should make sure this route is used only by us.
- snapshot-webhook sends a secret in the
authentication
header, Example: - We can add a variable in .env and check if the header is equal or not (for development env can be empty)
- For
const proposalId: string = req.body.proposalId || '';
In the event payload proposal id is proposal.id
@@ -0,0 +1,39 @@ | |||
<div align="center"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is weird here https://github.com/snapshot-labs/discord-bot/tree/setup-discord-bot
I see plain html 🙈 not sure why
Fixes partially snapshot-webhook/40
Background
This PR sets up the Discord Bot as a separate repo from snapshot-webhook
PR details
The logic is moved from
snapshot-webhook
to this repo in the following way:client
and connects to the existing Snapshot botsnapshot-webhook
snapshot-webhook
Current implementation (there is an error with Missing access, haven't sorted it out yet but it must be my settings on Discord for the app):
Related PRs
To Dos
client
anddb
@bonustrack @ChaituVR any comments welcome 🙏