Skip to content

Commit

Permalink
#patch added /discord, updated footer msg, added footer to more cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaribsin committed Mar 9, 2024
1 parent b93e4d6 commit a20c8f1
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 7 deletions.
42 changes: 42 additions & 0 deletions src/commands/discord.ts
Original file line number Diff line number Diff line change
@@ -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;
6 changes: 2 additions & 4 deletions src/commands/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ async function all(interaction: CommandInteraction) {
const title = event.title;
let message = event.message;
message = message.replace(/<i=1>/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});
}
Expand Down
3 changes: 2 additions & 1 deletion src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
5 changes: 4 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const configObj: Record<string, string | number | undefined> = {

// 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,
Expand Down
5 changes: 4 additions & 1 deletion src/handlers/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a20c8f1

Please sign in to comment.