update/configurable server name in welcome message

This commit is contained in:
SowinskiBraeden committed 2024-01-27 15:34:48 -08:00
1 parent dfe384c9b8
commit 639a2ecbb4
4 files changed
+33 -2

No files matched your search

+26
View File
@@ -364,6 +364,19 @@ module.exports = {
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: {
/**
@@ -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:
return client.sendInternalError(interaction, 'There was an error parsing the config command');
}
+2
View File
@@ -16,6 +16,7 @@ module.exports = {
return {
serverID: GuildId,
serverName: guild.server.serverName,
autoRestart: guild.server.autoRestart,
showKillfeedCoords: guild.server.showKillfeedCoords,
showKillfeedWeapon: guild.server.showKillfeedWeapon,
@@ -57,6 +58,7 @@ module.exports = {
getDefaultSettings(GuildId) {
return {
serverID: GuildId,
serverName: "our server!",
autoRestart: 0,
showKillfeedCoords: 0,
showKillfeedWeapon: 0,
+4 -1
View File
@@ -4,11 +4,14 @@ const { GetGuild } = require('../database/guild');
module.exports = async (client, member) => {
let GuildDB = await GetGuild(client, member.guild.id);
if (!client.exists(GuildDB.welcomeChannel)) return;
const channel = client.GetChannel(GuildDB.welcomeChannel);
if (GuildDB.serverName == "") GuildDB.serverName = "our server!"
let embed = new EmbedBuilder()
.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] });
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dayzr-bot",
"version": "12.6.0",
"version": "12.7.0",
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
"main": "index.js",
"nodemonConfig": {