Please look over - not for production
diff --git a/src/reflex/statsChannelUpdate.ts b/src/reflex/statsChannelUpdate.ts
index 6c601f7..e3c7a2a 100644
--- a/src/reflex/statsChannelUpdate.ts
+++ b/src/reflex/statsChannelUpdate.ts
@@ -1,7 +1,6 @@
import { getCommandMentionByName } from "../utils/getCommandDataByName.js";
import type { Guild, User } from "discord.js";
-import type { NucleusClient } from "../utils/client.js";
-import type { GuildMember } from "discord.js";
+import client from "../utils/client.js";
import convertCurlyBracketString from "../utils/convertCurlyBracketString.js";
import singleNotify from "../utils/singleNotify.js";
@@ -10,10 +9,8 @@
name: string;
}
-export async function callback(client: NucleusClient, member?: GuildMember, guild?: Guild, user?: User) {
- if (!member && !guild) return;
- guild = await client.guilds.fetch(member ? member.guild.id : guild!.id);
- user = user ?? member!.user;
+export async function callback(user: User, guild: Guild) {
+ guild = await client.guilds.fetch(guild.id);
const config = await client.database.guilds.read(guild.id);
Object.entries(config.stats).forEach(async ([channel, props]) => {
if ((props as PropSchema).enabled) {
@@ -22,16 +19,16 @@
string = await convertCurlyBracketString(string, user!.id, user!.username, guild!.name, guild!.members);
let fetchedChannel;
try {
- fetchedChannel = await guild!.channels.fetch(channel);
+ fetchedChannel = await guild.channels.fetch(channel);
} catch (e) {
fetchedChannel = null;
}
if (!fetchedChannel) {
const deleted = config.stats[channel];
- await client.database.guilds.write(guild!.id, null, `stats.${channel}`);
+ await client.database.guilds.write(guild.id, null, `stats.${channel}`);
return singleNotify(
"statsChannelDeleted",
- guild!.id,
+ guild.id,
`One or more of your stats channels have been deleted. You can use ${getCommandMentionByName(
"settings/stats"
)}.\n` + `The channels name was: ${deleted!.name}`,