Skip to content

eggsy/discord-is-sponsor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Discord: Is User Sponsor?

A bot that gives roles if a user is supporting you on GitHub! Uses Discord OAuth and Discord GitHub integration to get user's handle and then checks through GitHub GQL API.

Demo

demo.mp4

Requirements

Make sure they are all installed on your system before setting up this bot.

  • Discord bot account (get it from here)
  • GitHub access token (get it from here)
  • TypeScript
  • Node.js

Configuration

Before doing everything, make sure you have everything set up and ready to go. You'll also have to run npm install command or your preffered package manager command to install the dependencies.

  • Rename .env.example to .env and fill GITHUB_TOKEN, DISCORD_BOT_TOKEN and DISCORD_CLIENT_SECRET.
  • Rename src/config.example.ts to src/config.ts and fill the fields.
    • โš ๏ธ You'll also have to configure the Redirects from your Discord Application settings to the same Callback URL you use in this file.

Usage

Run the bot and wait until you see 3 successful messages in your console that states web server, bot and REST has started working fine. Then go to your server where you invited the bot (you have to invite the bot with the application_commands scope) and then run the slash command /get-sponsor-role. You can also do this by running the same command within the bot's DMs. The bot will send you an OAuth link to log you in and get the connections from your profile. Click on the link and login with your Discord account. It'll get your GitHub name and check if you are sponsoring the given person on GitHub, will give you all the roles that are set in the config if you do.

Notes

  • Since this bot is getting the GitHub username from user's Discord integrations, all users have to connect their GitHub accounts to Discord.

Backstory

It was created for @antfu's Discord server.

Any Problems?

Create an issue and let me know!

Sponsors

About

๐Ÿ™Œ Check if a Discord user is sponsoring you/someone on GitHub and give them roles!

Topics

Resources

License

Stars

Watchers

Forks