Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Larsundso committed Dec 13, 2023
1 parent bb9d515 commit 87c9fc3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
18 changes: 10 additions & 8 deletions src/BaseClient/ClientHelperModules/getPunishment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ async function f(
id as string,
options.ident as Parameters<typeof getWithType>[1],
options.includeTemp ?? false,
options.guildid as string,
) as ReturnType<typeof f>;
}

Expand Down Expand Up @@ -184,55 +185,56 @@ const getWithType = (
id: string,
type: 'warn' | 'mute' | 'ban' | 'channelban' | 'kick',
includeTemp: boolean,
guildid: string,
) => {
switch (type) {
case 'warn': {
return DataBase.punish_warns
.findMany({ where: { userid: id } })
.findMany({ where: { userid: id, guildid } })
.then((r) => r.map((p) => ({ ...p, type: 'punish_warns' })));
}
case 'mute': {
const perm = DataBase.punish_mutes
.findMany({ where: { userid: id } })
.findMany({ where: { userid: id, guildid } })
.then((r) => r.map((p) => ({ ...p, type: 'punish_mutes' })));
return includeTemp
? Promise.all([
perm,
DataBase.punish_tempmutes
.findMany({ where: { userid: id } })
.findMany({ where: { userid: id, guildid } })
.then((r) => r.map((p) => ({ ...p, type: 'punish_tempmutes' }))),
]).then((r) => r.flat())
: perm;
}
case 'ban': {
const perm = DataBase.punish_bans
.findMany({ where: { userid: id } })
.findMany({ where: { userid: id, guildid } })
.then((r) => r.map((p) => ({ ...p, type: 'punish_bans' })));
return includeTemp
? Promise.all([
perm,
DataBase.punish_tempbans
.findMany({ where: { userid: id } })
.findMany({ where: { userid: id, guildid } })
.then((r) => r.map((p) => ({ ...p, type: 'punish_tempbans' }))),
]).then((r) => r.flat())
: perm;
}
case 'channelban': {
const perm = DataBase.punish_channelbans
.findMany({ where: { userid: id } })
.findMany({ where: { userid: id, guildid } })
.then((r) => r.map((p) => ({ ...p, type: 'punish_channelbans' })));
return includeTemp
? Promise.all([
perm,
DataBase.punish_tempchannelbans
.findMany({ where: { userid: id } })
.findMany({ where: { userid: id, guildid } })
.then((r) => r.map((p) => ({ ...p, type: 'punish_tempchannelbans' }))),
]).then((r) => r.flat())
: perm;
}
case 'kick': {
return DataBase.punish_kicks
.findMany({ where: { userid: id } })
.findMany({ where: { userid: id, guildid } })
.then((r) => r.map((p) => ({ ...p, type: 'punish_kicks' })));
}
default: {
Expand Down
4 changes: 3 additions & 1 deletion src/BaseClient/ClientHelperModules/interactionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ const reply = async (
payload.embeds?.push(data);
});

const newUsers = cmd.customId.split('_').filter((u) => u !== author.id && u !== 'everyone');
const newUsers = cmd.customId
.split('_')
.filter((u) => String(encodeString2BigInt(u, 36)) !== author.id && u !== 'everyone');
newUsers.shift();

const lastUser = newUsers.length > 1 ? newUsers.pop() : undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/BaseClient/ClientHelperModules/mod/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ const mod = {
return mod.kickAdd(options, language, message, cmd);
case 'tempmute':
return mod.tempMuteAdd(
{ ...options, duration: Number(strike.duration) * 1000 },
{ ...options, duration: Number(strike.duration) },
language,
message,
cmd,
Expand Down
8 changes: 5 additions & 3 deletions src/BaseClient/Other/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Discord from 'discord.js';
import * as CT from '../../Typings/CustomTypings';

export const GuildTextChannelTypes = [
Discord.ChannelType.AnnouncementThread,
Expand Down Expand Up @@ -220,15 +221,16 @@ export default {
tempBanAdd: 'danger',
tempChannelBanAdd: 'danger',
channelBanAdd: 'danger',
channelBanRemove: 'danger',
channelBanRemove: 'success',
banRemove: 'success',
kickAdd: 'danger',
roleAdd: 'success',
roleRemove: 'danger',
muteRemove: 'danger',
tempMuteAdd: 'danger',
tempMuteAdd: 'success',
warnAdd: 'danger',
} as Record<string, keyof typeof colors>,
strikeAdd: 'danger',
} as Record<CT.ModTypes, keyof typeof colors>,
colors,
standard: {
dmLogChannelID: '825297763822469140',
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/AutocompleteCommands/mod/pardon/one.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const f: CT.AutoCompleteFile['default'] = async (cmd) => {

return punishments?.splice(0, 25).map((c) => ({
name: Number(c.uniquetimestamp).toString(36),
value: c.uniquetimestamp.toString(),
value: Number(c.uniquetimestamp).toString(36),
}));
};

Expand Down

0 comments on commit 87c9fc3

Please sign in to comment.