cms icon indicating copy to clipboard operation
cms copied to clipboard

Create a discord bot

Open hkirat opened this issue 1 year ago • 32 comments

That posts anytime there is

  1. An issue created
  2. An bounty dispensed on PR merge on a channel on discord

hkirat avatar Mar 10 '24 19:03 hkirat

ok , got it ..

Rash-Hit avatar Mar 10 '24 19:03 Rash-Hit

Did you mean discord bot? @hkirat And should this bot be a standalone project or should it be integrated with the existing cms?

nimit9 avatar Mar 10 '24 20:03 nimit9

lol yes

hkirat avatar Mar 10 '24 20:03 hkirat

And should this bot be a standalone project or should it be integrated with the existing cms?

@hkirat

nimit9 avatar Mar 10 '24 20:03 nimit9

can be independent project probably that's generic enough for anyone to ingrate

hkirat avatar Mar 10 '24 20:03 hkirat

Okay, will work on it, can you assign it to me?

nimit9 avatar Mar 10 '24 20:03 nimit9

@hkirat thanks for the clarity but cant we do this via webhooks ???

Rash-Hit avatar Mar 10 '24 20:03 Rash-Hit

I'm totally unsure of the approach here open to ideas

hkirat avatar Mar 10 '24 20:03 hkirat

@hkirat basically discord provide us a webhook url which we can connect with our github in setting .. and then can sync notification with discord ..

will send a video in few .. for confirmation

Rash-Hit avatar Mar 10 '24 20:03 Rash-Hit

ah ok seems straightforward then, video is much appreciated yes

hkirat avatar Mar 10 '24 20:03 hkirat

@hkirat will send .. now adding border to comment box and sending there for confirmation ... haha

Rash-Hit avatar Mar 10 '24 20:03 Rash-Hit

@hkirat please check here is the video , are we looking for something like this

https://github.com/code100x/cms/assets/73944177/dacbb699-b181-41ee-892b-3f225e694436

-- ps : compressing video took way more than the original task

Rash-Hit avatar Mar 10 '24 20:03 Rash-Hit

Can be done simply with discord.js

  • Listen to events in github when an issue or pr is created
  • scan for every message in the pr and if @hkirat sends /bounty ${number} parse with regex and post in discord
  • give the bounty to the author where @hkirat gives bounty

devsargam avatar Mar 11 '24 01:03 devsargam

hey @hkirat surr watch this may be this what you want. https://www.youtube.com/watch?v=-KDQqWNK3Tw

If not happy to make a custom discord bot :)

MAYANK-TRIPATH avatar Mar 11 '24 18:03 MAYANK-TRIPATH

@MAYANK-TRIPATH damn thanks for video its so easy with this approach

TanmayDhobale avatar Mar 11 '24 18:03 TanmayDhobale

@hkirat - The below video is an implementation for Bounty hunter discord notification . If the approach is okay, can add logic for issue creation as well.

https://github.com/code100x/cms/assets/67855887/6bcf7cd8-3fad-42fd-b98c-ea961fba8eee

aadeshkulkarni avatar Mar 15 '24 13:03 aadeshkulkarni

DAMN BOT looks fine to me , but bro light mode ??

TanmayDhobale avatar Mar 15 '24 13:03 TanmayDhobale

@hkirat,

I've set up GitHub workflows for push notifications on new issues and bounties. Let me know your thoughts on sticking with this method.

Adding a video for your reference:

demo.webm

haddercone avatar Mar 15 '24 16:03 haddercone

@aadeshkulkarni @haddercone what do you think of this?

https://github.com/code100x/cms/assets/76874341/2523985c-84d1-46d7-833d-557cb9b113ae

devsargam avatar Mar 15 '24 22:03 devsargam

create issues or pr in this repo for testing: https://github.com/devsargam/100xbounty-bot

Updates: https://discord.gg/kFxQKbUG this channel

devsargam avatar Mar 15 '24 22:03 devsargam

https://discord.gg/kFxQKbUG

Looks good @devsargam.

Curious to know the purpose of adding an additional comment on the Gh PR (since the /bounty $x comment also conveys a similar message)

On a different note, my approach requires the maintainer to setup github webhook, discord webhook & make changes in env. I liked @haddercone's approach more because it requires minimal configuration on the maintainer's side to get it up and running.

Interested to know what your approach is.

aadeshkulkarni avatar Mar 16 '24 06:03 aadeshkulkarni

Curious to know the purpose of adding an additional comment on the Gh PR (since the /bounty $x comment also conveys a similar message)

That comment is just a reference, in future it can be a call to different api to directly dispense the bounty amount Also, just showing the webhook on discord can fail at times

Actually mine approach is even bare minimum since you just need to add the app to github repo Try adding this app to one of your repo: https://github.com/apps/100xbountybot

devsargam avatar Mar 16 '24 07:03 devsargam

Actually mine approach is even bare minimum since you just need to add the app to github repo Try adding this app to one of your repo: https://github.com/apps/100xbountybot

Tried it. Loved it. This is probably the best approach.

aadeshkulkarni avatar Mar 16 '24 07:03 aadeshkulkarni

Also: @aadeshkulkarni image

devsargam avatar Mar 16 '24 07:03 devsargam

The application looks great @devsargam!

I'm just curious to know about setting up Discord notifications for my personal channel within the app. I've saw that when I write the bounty comment, the reply occurs on the PR itself.

How can I receive these notifications on my own channel? Thanks

haddercone avatar Mar 16 '24 08:03 haddercone

@haddercone thanks 😇

You could either setup your own instance

Or

I can create a command like /setup webhook https://example.com Which probably requires some type of db happy to do it if u say so

devsargam avatar Mar 16 '24 08:03 devsargam

@devsargam, I was just curious about the setup that's all ☺️.

I was thinking from a point, where we would need to add the bots to the cohort 2 server. The application works fine with current configurations.

In current scenario we might have to setup a separate instance for the cohort 2 server.

haddercone avatar Mar 16 '24 09:03 haddercone

@haddercone yepp, you're correct 💯

@hkirat is more than qualified to setup for cohort server

devsargam avatar Mar 16 '24 09:03 devsargam

I can see two PR for this issue, but if it is not too late can I also work on this one? @hkirat @devsargam

neutr0n420 avatar Mar 17 '24 17:03 neutr0n420

@neutr0n420 already resolved with #225

devsargam avatar Mar 17 '24 18:03 devsargam