update/configurable server name in welcome message
This commit is contained in:
4 files changed
+33
-2
No files matched your search
@@ -364,6 +364,19 @@ module.exports = {
|
|||||||
required: true,
|
required: true,
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "welcome_message_server_name",
|
||||||
|
description: "Configure the server name in the welcome message",
|
||||||
|
value: "welcome_message_server_name",
|
||||||
|
type: CommandOptions.SubCommand,
|
||||||
|
options: [{
|
||||||
|
name: "name",
|
||||||
|
desciption: "Server name to include in welcome message",
|
||||||
|
value: "name",
|
||||||
|
type: CommandOptions.String,
|
||||||
|
required: true,
|
||||||
|
}]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
SlashCommand: {
|
SlashCommand: {
|
||||||
/**
|
/**
|
||||||
@@ -787,6 +800,19 @@ module.exports = {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'welcome_message_server_name':
|
||||||
|
const server_name = args[0].options[0].value;
|
||||||
|
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.serverName":server_name}}, (err, res) => {
|
||||||
|
if (err) return client.sendInternalError(interacion, err);
|
||||||
|
});
|
||||||
|
|
||||||
|
const succcessUpdateServerName = new EmbedBuilder()
|
||||||
|
.setDescription(`Successfully configured the server name to **${server_name}** in the welcome message.`)
|
||||||
|
.setColor(client.config.Colors.Green);
|
||||||
|
|
||||||
|
return interaction.send({ embeds: [succcessUpdateServerName] });
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return client.sendInternalError(interaction, 'There was an error parsing the config command');
|
return client.sendInternalError(interaction, 'There was an error parsing the config command');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ module.exports = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
serverID: GuildId,
|
serverID: GuildId,
|
||||||
|
serverName: guild.server.serverName,
|
||||||
autoRestart: guild.server.autoRestart,
|
autoRestart: guild.server.autoRestart,
|
||||||
showKillfeedCoords: guild.server.showKillfeedCoords,
|
showKillfeedCoords: guild.server.showKillfeedCoords,
|
||||||
showKillfeedWeapon: guild.server.showKillfeedWeapon,
|
showKillfeedWeapon: guild.server.showKillfeedWeapon,
|
||||||
@@ -57,6 +58,7 @@ module.exports = {
|
|||||||
getDefaultSettings(GuildId) {
|
getDefaultSettings(GuildId) {
|
||||||
return {
|
return {
|
||||||
serverID: GuildId,
|
serverID: GuildId,
|
||||||
|
serverName: "our server!",
|
||||||
autoRestart: 0,
|
autoRestart: 0,
|
||||||
showKillfeedCoords: 0,
|
showKillfeedCoords: 0,
|
||||||
showKillfeedWeapon: 0,
|
showKillfeedWeapon: 0,
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ const { GetGuild } = require('../database/guild');
|
|||||||
module.exports = async (client, member) => {
|
module.exports = async (client, member) => {
|
||||||
|
|
||||||
let GuildDB = await GetGuild(client, member.guild.id);
|
let GuildDB = await GetGuild(client, member.guild.id);
|
||||||
|
if (!client.exists(GuildDB.welcomeChannel)) return;
|
||||||
const channel = client.GetChannel(GuildDB.welcomeChannel);
|
const channel = client.GetChannel(GuildDB.welcomeChannel);
|
||||||
|
|
||||||
|
if (GuildDB.serverName == "") GuildDB.serverName = "our server!"
|
||||||
|
|
||||||
let embed = new EmbedBuilder()
|
let embed = new EmbedBuilder()
|
||||||
.setColor(client.config.Colors.Default)
|
.setColor(client.config.Colors.Default)
|
||||||
.setDescription(`**Welcome** <@${member.user.id}> to **DayZ Reforger**\nTo gain access please use the command </gamertag-link:1087116946442559609>`);
|
.setDescription(`**Welcome** <@${member.user.id}> to **${GuildDB.serverName}**\nUse the </gamertag-link:1087116946442559609> command to link your Discord to your gamertag.`);
|
||||||
|
|
||||||
channel.send({ content: `<@${member.user.id}>`, embeds: [embed] });
|
channel.send({ content: `<@${member.user.id}>`, embeds: [embed] });
|
||||||
};
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dayzr-bot",
|
"name": "dayzr-bot",
|
||||||
"version": "12.6.0",
|
"version": "12.7.0",
|
||||||
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
|
|||||||
Reference in new issue
Block a user