Skip to content

Commit

Permalink
small cleanup to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
N1kO23 committed Feb 2, 2022
1 parent 7e81796 commit 3c19ccd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/plugins/announce.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Discord from "discord.js";
import Discord, { APIErrors } from "discord.js";
import logger from "../shaii/Logger.shaii";
import { definePlugin } from "../shaii/Plugin.shaii";
import { defineCommand } from "../types";
Expand Down Expand Up @@ -33,10 +33,12 @@ export default definePlugin({
.setDescription(announcementMessage)
.setFooter("Generated with Announcer plugin made by Qexat");

announcementChannel.send({ content: mention, embeds: [embed] }).catch((err) => {
try {
await announcementChannel.send({ content: mention, embeds: [embed] });
} catch (err: any) {
logger.error(err);
return ":x: Could not create the announcement message.";
});
}

return `:white_check_mark: Successfully created the announcement message in <#${announcementChannel.id}>`;
},
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/fun-fact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default definePlugin({
category: "FUN",
usage: "funfact",
description: "Random fun fact",
execute: (message) => {
execute: () => {
const embed = new Discord.MessageEmbed()
.setColor("#d2185e")
.setAuthor(`Fun Facts by azur`)
Expand Down
7 changes: 3 additions & 4 deletions src/plugins/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ const report = defineCommand({
.setColor("#FFAF2F");

const out = { content: content || "No file was attached.", embeds: [embed] };
(
message.client.guilds.cache
.get(GEOXOR_GUILD_ID)!
.channels.cache.get(GEOXOR_STAFF_CHANNEL_ID) as Discord.TextChannel
// This is kinda scuff
await (
message.client.guilds.cache.get(GEOXOR_GUILD_ID)!.channels.cache.get(GEOXOR_STAFF_CHANNEL_ID) as Discord.TextChannel
).send(out);
return out;
},
Expand Down

0 comments on commit 3c19ccd

Please sign in to comment.