To setup, change line 5 and line 6 to your verify channel id and verified role id. To use it, use !verify <your roblox username> And it will show you how to verify
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
const jimp = require('jimp');
let verifyChannel = `989765669828558859`; //your verify channel
let verifyRoleID = `989753349551296524`; //your Role if verify done
let sleep = async (ms) => {
//sleep command
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, ms || 0);
});
};
if (context.params.event.channel_id == verifyChannel) {
//check if message is in verify channel
if (context.params.event.member.roles.includes(verifyRoleID)) {
//check if user already verify
await lib.discord.channels['@0.3.4'].messages.destroy({
//delete message
message_id: context.params.event.id,
channel_id: context.params.event.channel_id,
});
let picturemsg = await lib.discord.users['@0.1.4'].dms.create({
//sent DM
recipient_id: `${context.params.event.author.id}`,
content: `You already verified`,
});
} else {
if (!context.params.event.content.split(' ')[1]) {
//not put the Roblox username
let message = await lib.discord.channels['@0.3.4'].messages.create({
channel_id: context.params.event.channel_id,
content: `User not found, please try again \`!verify \``,
});
return;
}
let username = context.params.event.content.split(' ')[1]; //set username
let link = `https://users.roblox.com/v1/users/search?keyword=${username}&limit=10`;
let data = await axios(link).catch((err) => {});
if (!data)
return await lib.discord.channels['@0.3.4'].messages.create({
channel_id: context.params.event.channel_id,
content: `Can't Find this user (Please check name again)`,
});
else data = data.data;
data = data.data[0];
//37-41 get user info with username
if (data) {
username = data.name; //set username again
} else {
return await lib.discord.channels['@0.3.4'].messages.create({
channel_id: context.params.event.channel_id,
content: `Can't Find this user (Please check name again)`,
});
}
let link2 = `https://thumbnails.roblox.com/v1/users/avatar?userIds=${data.id}&size=720x720&format=Png`;
let data2 = await axios(link2).catch((err) => {});
if (!data2)
return await lib.discord.channels['@0.3.4'].messages.create({
channel_id: context.params.event.channel_id,
content: `Picture not found`,
});
else data2 = data2.data.data[0].imageUrl;
//44-47 get image url
let link3 = `https://users.roblox.com/v1/users/${data.id}`;
let data3 = await axios(link3).catch((err) => {});
if (!data3)
return await lib.discord.channels['@0.3.4'].messages.create({
channel_id: context.params.event.channel_id,
content: `Description not found`,
});
else data3 = data3.data.description;
//49-52 get description (About) of user
if (data3 == username) {
//check if description (About) is same as username
await lib.discord.guilds['@0.1.3'].members.roles.update({
//give role
role_id: `${verifyRoleID}`,
user_id: `${context.params.event.author.id}`,
guild_id: `${context.params.event.guild_id}`,
});
await lib.discord.guilds['@0.1.0'].members.update({
//change nickname to Roblox username
guild_id: context.params.event.guild_id,
user_id: context.params.event.author.id,
nick: username,
});
await lib.discord.channels['@0.3.4'].messages.create({
//just sent a message
channel_id: `${context.params.event.channel_id}`,
content: `Verify done! Hope you enjoy our server!`,
});
} else {
//70-81 make the picture
let message2 = await lib.discord.channels['@0.3.0'].messages.create({
//sent how to verify message
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embeds: [
{
type: 'rich',
title: `Roblox verification for ${username}`,
description: `How to verify?\n1) click the Title (Roblox verification for ${username})\n2) go to About\n3) change your roblox About to \`${username}\`\n4) if you done all, use \`!verify ${username}\` again`,
color: 0xff9100,
image: {
url: `https://media.discordapp.net/attachments/950194809828683866/989759792564289586/unknown.png`,
height: 0,
width: 0,
},
thumbnail: {
url: `${data2}`,
height: 0,
width: 0,
},
footer: {
text: `Made by Vorapon T. alt#6700`, //please dont delete the credit
},
url: `https://www.roblox.com/users/${data.id}/profile`,
},
],
});
}
}
}