This is a snippet to filter out suspicious users from your Discord server. When a new user runs "/verify", they will get the role you set as the Environment Variable "Verified". You will need to create a command called "/verify" in the command builder: https://autocode.com/tools/discord/command-builder/
//autheticates code to bot (Token Login)
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
/*
Setup:
1. Create a Slash Command named "verify" in the command builder: https://autocode.com/tools/discord/command-builder/
2. Create a channel in your Discord server for where users will use the verification command to get the role
3. Set the permission "View Channels" for the role everyone to enabled in the Server Settings. (Do this for your Verified role too).
4. Set the permission "View Channels" for the role everyone to disabled on each channels in your server. (Means channels that you don't want the unverified users ((users before getting the verified role)) to view).
5. Set the permission "View Channels" for your Verified role in your verification channel to disable in its channel settings.
6. Also make sure you have the permission "View Channels" for your everyone role in each channel to default. (The / icon)
7. Use /verify and you'll get your Verified role assigned to your profile :D.
If you want to create a custom command, make sure to change the command name in the Endpoint Trigger as well.
*/
//Process Verified role from Environmetal Variables
let verifiedRole = `${process.env.Verified}`;
//Assigns role to member after using /verify
await lib.discord.guilds['@0.1.0'].members.roles.update({
role_id: `${verifiedRole}`,
user_id: context.params.event.member.user.id,
guild_id: `${context.params.event.guild_id}`,
});