diff --git a/src/commands/discord.ts b/src/commands/discord.ts new file mode 100644 index 0000000..ebb3ac6 --- /dev/null +++ b/src/commands/discord.ts @@ -0,0 +1,42 @@ +import { + CommandInteraction, + EmbedBuilder, + SlashCommandBuilder, +} from 'discord.js'; +import {Command} from '../interfaces'; +import {EMBED_COLOUR, FOOTER_MESSAGE} from './_components'; +import {config} from '../config'; + +const DISCORD_INVITE = config.DISCORD_INVITE; + +const command: Command = { + data: new SlashCommandBuilder() + .setName('discord') + .setDescription('HellCom Discord invite'), + run: async interaction => { + await interaction.editReply({ + content: DISCORD_INVITE, + embeds: [ + new EmbedBuilder() + .setTitle('Leviathan Alliance - Helldivers 2 Community') + .setDescription( + 'HellCom is part of **Leviathan Alliance**! ' + + '\n\n' + + 'Leviathan Alliance is a community of like-minded Helldivers who are passionate about Helldivers 2! We welcome every level and skill into our server with open arms. We also built this server knowing that the main Helldivers discord can be hectic and overwhelming, so we hope you can find friendly Helldivers more easily here!' + + '\n\n' + + 'You may also see patches for the bot, report bugs or give suggestions __for the bot__. ' + + 'If you would like to invite the bot to your own server, you may do so with ' + + '__**[this link (click)](https://discord.com/api/oauth2/authorize?client_id=1213944670288347176&permissions=414464658496&scope=applications.commands%20bot)**__ (you must be a server admin).' + + '\n\n' + + 'Thanks for your interest in the project! <3' + ) + .setURL(DISCORD_INVITE) + .setFooter({text: FOOTER_MESSAGE}) + .setColor(EMBED_COLOUR) + .setTimestamp(), + ], + }); + }, +}; + +export default command; diff --git a/src/commands/events.ts b/src/commands/events.ts index cd12d6d..195e840 100644 --- a/src/commands/events.ts +++ b/src/commands/events.ts @@ -41,13 +41,11 @@ async function all(interaction: CommandInteraction) { const title = event.title; let message = event.message; message = message.replace(//g, '*').replace(/<\/i>/g, '*'); - const embed = new EmbedBuilder() - .setTitle(title) - .setFooter({text: FOOTER_MESSAGE}) - .setTimestamp(); + const embed = new EmbedBuilder().setTitle(title).setTimestamp(); if (message) embed.setDescription(message); embeds.push(embed); } + embeds[embeds.length - 1].setFooter({text: FOOTER_MESSAGE}).setTimestamp(); await interaction.editReply({embeds: embeds}); } diff --git a/src/commands/index.ts b/src/commands/index.ts index 544ed42..e647ce6 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,11 +1,12 @@ import {CommandInteraction, ModalSubmitInteraction} from 'discord.js'; import {Command} from '../interfaces'; import campaign from './campaign'; +import discord from './discord'; import events from './events'; import planet from './planet'; import subscribe from './subscribe'; -const commandList: Command[] = [planet, events, campaign, subscribe]; +const commandList: Command[] = [planet, events, campaign, subscribe, discord]; const notEphemeral = ['subscribe']; const ephemeralCmds = commandList .map(x => x.data.name) diff --git a/src/config.ts b/src/config.ts index b56f94f..a7413af 100644 --- a/src/config.ts +++ b/src/config.ts @@ -13,7 +13,10 @@ const configObj: Record = { // Bot Commands EMBED_COLOUR: process.env.EMBED_COLOUR || 'DarkPurple', - FOOTER_MESSAGE: `v${version} | made for Helldivers`, + FOOTER_MESSAGE: + 'Bug reports and suggestions welcome in Discord!\n' + + `/discord | v${version} | made by Major`, + DISCORD_INVITE: 'https://discord.gg/levialliance', // Project info VERSION: version, diff --git a/src/handlers/embed.ts b/src/handlers/embed.ts index 39fcc7b..e40dcab 100644 --- a/src/handlers/embed.ts +++ b/src/handlers/embed.ts @@ -139,7 +139,10 @@ export function warStatusEmbeds() { ) .addFields(status['Terminids']); - return [automatonEmbed, terminidEmbed]; + const embeds = [automatonEmbed, terminidEmbed]; + embeds[embeds.length - 1].setFooter({text: FOOTER_MESSAGE}).setTimestamp(); + + return embeds; } export async function campaignEmbeds(planet_name?: string) {