diff --git a/src/features/rules.ts b/src/features/rules.ts index e416ba6..f080ee8 100644 --- a/src/features/rules.ts +++ b/src/features/rules.ts @@ -11,50 +11,60 @@ import { OnStartupHandler } from '../types'; const RULES_CHANNEL_ID = process.env.RULES_CHANNEL_ID ?? '752553802359505020'; const INTRO_CHANNEL_ID = '766393115044216854'; -// const HELP_CHANNEL_ID = '752668543891276009'; -// const OFFTOPIC_CHANNEL_ID = '766433464055496744'; -// const SHOWCASE_CHANNEL_ID = '771729272074534922'; -// const KUDOS_CHANNEL_ID = '911305422307225682'; -// const GENERAL_CHANNEL_ID = '752647196419031042'; - -// 'https://i.imgur.com/Zqc3Nc6.png', -// ` -// Welcome to the official Next.js Discord server! - -// This is the place to chat about Next.js, ask questions, show off your projects, and collaborate with other developers. - -// **Here's a quick breakdown of our channels:** -// <#${GENERAL_CHANNEL_ID}>:: General chat about Next.js -// <#${HELP_CHANNEL_ID}>: Ask for help with Next.js -// <#${OFFTOPIC_CHANNEL_ID}>: Anything else you want to talk about -// <#${SHOWCASE_CHANNEL_ID}>: Show off your Next.js projects -// <#${KUDOS_CHANNEL_ID}>: Shout out people who helped you out - -// We abide by our Code of Conduct. Please read it: -// `, +const HELP_CHANNEL_ID = '1007476603422527558'; +const OFFTOPIC_CHANNEL_ID = '766433464055496744'; +const SHOWCASE_CHANNEL_ID = '771729272074534922'; +const KUDOS_CHANNEL_ID = '911305422307225682'; +const GENERAL_CHANNEL_ID = '752647196419031042'; +const JOBS_CHANNEL_ID = '910564441119150100'; +const FEEDBACK_CHANNEL_ID = '843997308616966145'; const RULES_MESSAGES = [ - `**To unlock the rest of the server, make sure to introduce yourself in the <#${INTRO_CHANNEL_ID}> channel!** Use this template: - -🌎 I'm from: Italy -🏢 I work at: Amazon -💻 I work with this tech: Next.js, Typescript, Tailwind, and Prisma -🍎 I snack on: ☕ - -Also, tell us what tools you use so we can automatically add you to the relevant channels! - -<:javascript:770004227366846494> : JavaScript - -<:typescript:770004243545325580> : TypeScript - -<:tailwind:913088128468787210> : Tailwind - -<:rust:913088096692748349> : Rust - -<:swr:770004547422650388> : SWR - -<:mdx:935667057121439805> : MDX - `, + 'https://i.imgur.com/r9Etfje.png', + ` +‎ +👋 Welcome to the official Next.js Discord server! This is the place to chat about Next.js, ask questions, show off your projects, and collaborate with other developers. + +📖 We abide by our Code of Conduct. Please read it: + +🙋 Introduce yourself in the <#${INTRO_CHANNEL_ID}> channel, we'd love to learn more about you and what you're working on! + +✨ Customize your profile in by adding your own name color or custom roles + +🔍 **Here's a quick breakdown of our most popular channels:** + +<#${GENERAL_CHANNEL_ID}> — General chat about Next.js +<#${HELP_CHANNEL_ID}> — Ask for help with Next.js +<#${OFFTOPIC_CHANNEL_ID}> — Anything else you want to talk about +<#${SHOWCASE_CHANNEL_ID}> — Show off your Next.js projects +<#${KUDOS_CHANNEL_ID}> — Shout out people who helped you out + +📜 **Server Rules** + +1. Treat everyone with respect. No NFSW content or spam +2. No self-promotion (server invites, advertisements, etc.) outside the correct channels. This includes DMing fellow members +3. Job posts in this server are not allowed, refer to <#${JOBS_CHANNEL_ID}> if you want to hire someone or are looking for a job +4. Do not DM members randomly +5. Do not mention (\`@ping\`) people not in the conversation +6. Do not use an avatar, nickname, or profile that breaks any of the rules +7. Moderators will delete messages posted on the wrong channel, please read the channel descriptions before posting +8. Bumping posts in <#${HELP_CHANNEL_ID}> is allowed to avoid having it going down the list if you still need help. Do not do it more than once a day + +If you see something against the rules or something that makes you feel unsafe, let the staff know. We want this server to be a welcoming space! +We are always looking to improve the server. Feel free to share your ideas or opinions in <#${FEEDBACK_CHANNEL_ID}> +`, + ` +‎ +✍️ **Tips to get help faster** + +1. Don't ask to ask, just ask: +2. If you are facing an error, share the full error message and what you think might be causing it +3. Always try to add this to your questions when applicable: "What are you expecting to happen?", "What is happening instead?", "What have you tried?" +4. Include the relevant dependencies you are working with. \`next info\` will give you a list to get you started +5. Share the project or a minimal reproduction of the issue, this allows people to investigate better the problem + +More tips: +`, ]; export const onStartup: OnStartupHandler = async (client) => { diff --git a/src/features/welcomeQuestions.ts b/src/features/welcomeQuestions.ts deleted file mode 100644 index 801b5e3..0000000 --- a/src/features/welcomeQuestions.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -import { OnReactionHandler } from '../types'; - -/** - * Welcome Questions Module - * --- - * The bot will keep track of the reactions to a message to assign users certain roles which then adds them to the relevant channels - */ - -type LanguageObject = { - [key: string]: string; -}; - -const LANGUAGES: LanguageObject = { - javascript: '913086422351769610', - typescript: '913086489229918238', - tailwind: '913086567042674719', - rust: '913086533387567165', - swr: '915643752406720592', - mdx: '935666082100957234', -}; - -// Make sure to update this message ID when bot generates a new one -const LANGUAGES_MESSAGE_ID = '913092687924695071'; - -export const onReactionAdd: OnReactionHandler = async ( - client, - reaction, - user -) => { - const { message } = reaction; - - // if message isn't the welcome message, exit - if (message.id !== LANGUAGES_MESSAGE_ID) { - console.log('msg is NOT in the welcome channel'); - return; - } else { - console.log('msg is in the welcome channel'); - } - - // If reaction isn't one of the ones provided above, exit - if (!Object.keys(LANGUAGES).includes(reaction.emoji.name!)) { - console.log('emoji is NOT in there'); - return; - } else { - console.log('emoji is in there'); - } - - // Now we've certified a valid emoji and message ID, assign role to user - const member = await message - .guild!.members.fetch(user.id) - .catch((err) => console.log(err.message)); - if (!member) return; - - const language = LANGUAGES[reaction.emoji.toString().split(':')[1]]; - member.roles.add(language).catch((err) => console.log(err.message)); -}; - -export const onReactionRemove: OnReactionHandler = async ( - client, - reaction, - user -) => { - const { message } = reaction; - // if message isn't the welcome message, exit - if (message.id !== LANGUAGES_MESSAGE_ID) { - console.log('msg is NOT in the welcome channel'); - return; - } else { - console.log('msg is in the welcome channel'); - } - - // If reaction isn't one of the ones provided above, exit - if (!Object.keys(LANGUAGES).includes(reaction.emoji.name!)) { - console.log('emoji is NOT in there'); - return; - } else { - console.log('emoji is in there'); - } - - // Now we've certified a valid emoji and message ID, assign role to user - const member = await message - .guild!.members.fetch(user.id) - .catch((err) => console.log(err.message)); - if (!member) return; - - const language = LANGUAGES[reaction.emoji.toString().split(':')[1]]; - member.roles.remove(language).catch((err) => console.log(err.message)); -};