This bot allows Learn Build Teach Discord members to share content, give kudos to other members, etc.
For a quick a overview of how to create a Discord Bot with Node.js here are a few resources.
- Discord Bot Tutorial | JavaScript & Node.js
- Create a Discord Bot with Node.js
- Code a Discord Bot with JavaScript - Host for Free in the Cloud
Individual commands have their own file inside of the /src/commands
directory. Each command should export an object with three properties.
- callback - a callback function that is triggered when the command is used
- name - the name of the command
- description - short description of what the command does
The callback function accepts one parameter which is a Command Interaction
. Check out Creating Slash Commands Documentation for more info.
Here is an example.
const resetProfile = async (interaction: CommandInteraction) => {
//some logic
};
export default {
callback: resetProfile,
name: 'resetprofile',
description: 'Reset your profile settings',
};
The backend is a Node.js and Express app. This is used to handle API requests that are deteailed in the /src/server/routes
directory.
These are utility files for interacting with Discord, Supabase, Twitter, etc.
npm install
You can get the API keys from the following websites
In a .env
file, make sure to include the requied environment variables listed below.
You will need to create your own test server in Discord as well as a project in Supabase. We are thinking through easier ways to help with this process if you have ideas.
Required Varaiables
#Supabase
SUPABASE_SERVICE_ROLE_KEY=
SUPABASE_PROJECT_URL=
#Discord
DISCORD_BOT_TOKEN=
DISCORD_GUILD_ID=
Optional Variables
#Api - used for authentication on API requests
SERVER_API_KEY=
#Email alerts - used to send email alerts based on errors
EMAIL_ALERTS_ON=
EMAIL_ALERTS_RECIPIENT=
EMAIL_ALERTS_SENDER=
SENDGRID_API_KEY=
#Twitter - used for sending automatic tweets of content
SEND_TWEETS=
TWITTER_ACCESS_TOKEN_KEY=
TWITTER_ACCESS_TOKEN_SECRET=
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
#Discord Admin - used for reviewing shared content
DISCORD_ADMIN_SHARE_REVIEW_CHANNEL= #(optional)
npm run dev
Get profile details about you or another discord member.
Update your profile with the following flags. I will use these pieces of information to help share your content.
twitter
: your Twitter handletwitch
: your Twitch usernameyoutube
: your YouTube URLinstagram
: your Instagram usernamegithub
: your Github usernamewebsite
: your personal website URL
Clear your existing profile in case your display name has changed, you entered incorrect info, etc.
Share a piece of content (article, video, etc.) by including a valid URL. These pieces of content will considered for sharing on Twitter and/or the James Q Quick newsletter. You can (optionally) include a suggested tweet text after the URL.
ex. /share https://www.jamesqquick.com/ This is a suggested tweet text
Give Kudos to another user. Kudos will be automatically given when reacting to a post using the following emojis: 'learn', 'build', and 'teach'.
View the Kudos Leaderboard.