mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-14 21:26:54 +00:00
Finished the welcome message command
This commit is contained in:
@@ -36,17 +36,21 @@ async function execute(bot, message, args, command, Discord, mongouri, items, xp
|
||||
|
||||
//Chose the appropriate command
|
||||
command = args[0];
|
||||
if (args[1] == undefined) {
|
||||
return message.reply("Please specify what the new value is!");
|
||||
}
|
||||
|
||||
if (command == 'welcome_channel') {
|
||||
if (args.length != 2) { return message.reply('The command format is _!setup welcomechannel <channel name>_'); }
|
||||
if (args.length != 2) { return message.reply('The command format is _!setup welcome_channel <channel name>_'); }
|
||||
// setWelcomeChannel(dbo, message, args[1]);
|
||||
const channel = message.guild.channels.cache.find(ch => ch.name === args[1]);
|
||||
dbo.updateOne({welcomechannel: {$exists: true}}, {$set: {welcomechannel: `${channel.id}`}});
|
||||
} else if (command == 'welcome_message') {
|
||||
dbo.updateOne({welcomemessage: {$exists: true}}, {$set: {welcomemessage: args[1]}})
|
||||
if (args.length < 2) { return message.reply('The command format is _!setup welcome\\_message_\nUse _{sn}_ to insert the server name, _{un}_ to insert the user name, and _{ut}_ to insert the user tag\nExample: _!setup welcome\\_message Welcome to {sn} Sir {un}#{ut}_'); }
|
||||
let msg = "";
|
||||
for (let i = 1; i < args.length; i ++ ) {
|
||||
msg += args[i] + ' ';
|
||||
}
|
||||
|
||||
if (msg.length > 30) { return message.reply('Please specify a welcome message under 30 characters!'); }
|
||||
dbo.updateOne({welcomemessage: {$exists: true}}, {$set: {welcomemessage: msg}})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -54,10 +54,14 @@ async function welcome(member, welcomechannel, welcomemessage = null, welcomeban
|
||||
|
||||
//message.author.username == interaction.member.displayName
|
||||
//message.guild.name == interaction.member.guild.name
|
||||
let txt = 'Welcome to';
|
||||
if (welcomemessage != null) { txt = welcomemessage}
|
||||
let text = `Welcome to ${member.guild.name} ${member.user.username}#${member.user.discriminator}!`;
|
||||
if(welcomemessage != null) {
|
||||
text = welcomemessage;
|
||||
text = text.replace('{sn}', member.guild.name);
|
||||
text = text.replace('{un}', member.user.username);
|
||||
text = text.replace('{ut}', member.user.discriminator);
|
||||
}
|
||||
|
||||
const text = `${txt} ${member.guild.name} ${member.user.username}#${member.user.discriminator}!`;
|
||||
context.font = applyText(canvas, text);
|
||||
context.fillStyle = '#ffffff';
|
||||
context.fillText(text, (canvas.width/2) - (text.length * 7.5), canvas.height - 15);
|
||||
|
||||
Reference in New Issue
Block a user