Skip to content

Commit

Permalink
easy
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Nov 2, 2024
1 parent 05b74bf commit 786a14e
Show file tree
Hide file tree
Showing 28 changed files with 110 additions and 110 deletions.
6 changes: 3 additions & 3 deletions src/commands/admin/TrollMoveUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class TrollMoveUser {
type: ApplicationCommandOptionType.Integer,
})
timeout: number = 0,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
await interaction.deferReply({ ephemeral: true });

Expand All @@ -72,7 +72,7 @@ export class TrollMoveUser {
});

const allVoiceChannels = (await interaction.guild!.channels.fetch()).filter(
(c) => c?.type === ChannelType.GuildVoice
(c) => c?.type === ChannelType.GuildVoice,
);

for (const [id, channel] of allVoiceChannels) {
Expand All @@ -83,7 +83,7 @@ export class TrollMoveUser {
}

const guildMember = (await interaction.guild?.members.fetch(
user.id
user.id,
)) as GuildMember;

if (count > 0) moveMemberToChannel(guildMember);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/DeleteMemberDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class DeleteMemberDb {
type: ApplicationCommandOptionType.User,
})
user: User,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
// get member from slash command input

Expand Down
4 changes: 2 additions & 2 deletions src/commands/mod/DeleteMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class DeleteMessages {
type: ApplicationCommandOptionType.String,
})
amount: number,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
LogService.logCommandHistory(interaction, "delete-messages");
// get member from slash command input
Expand All @@ -45,7 +45,7 @@ export class DeleteMessages {
}
return acc;
},
[[]] as Message<boolean>[][]
[[]] as Message<boolean>[][],
);

for (const message of messageList) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/DeleteUserMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class DeleteMessages {
type: ApplicationCommandOptionType.Boolean,
})
jail: boolean = false,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
LogService.logCommandHistory(interaction, "delete-user-messages");
const memberId = user?.id ?? userId;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/LogCommandHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class LogCommandHistory {
type: ApplicationCommandOptionType.String,
})
count: string,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
LogService.logCommandHistory(interaction, "log-command-history");
const c = count ? Number(count) : 10;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod/LogDeletedMessagesHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class LogDeletedMessagesHistory {
type: ApplicationCommandOptionType.String,
})
count: string,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
LogService.logCommandHistory(interaction, "log-deleted-messages-history");
const c = count ? Number(count) : 10;
Expand Down
4 changes: 2 additions & 2 deletions src/commands/mod/LookbackMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class LookbackMembers {
type: ApplicationCommandOptionType.Integer,
})
lookback: number,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
LogService.logCommandHistory(interaction, "lookback-members");
// get guild data
Expand All @@ -40,7 +40,7 @@ export class LookbackMembers {

// send success message
return await interaction.reply(
`Lookback set to ${lookback} days for ${guildName}`
`Lookback set to ${lookback} days for ${guildName}`,
);
}
}
4 changes: 2 additions & 2 deletions src/commands/user/LookbackMe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class LookbackMe {
type: ApplicationCommandOptionType.Integer,
})
lookback: number,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
LogService.logCommandHistory(interaction, "lookback-me");
// get guild data
Expand All @@ -39,7 +39,7 @@ export class LookbackMe {

// send success message
return await interaction.reply(
`Lookback set to ${lookback} days for ${interaction.member?.user.username}`
`Lookback set to ${lookback} days for ${interaction.member?.user.username}`,
);
}
}
2 changes: 1 addition & 1 deletion src/commands/user/Me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class Me {
// if not bot channel, return
if (!BOT_CHANNELS.includes(channel.name))
return await interaction.editReply(
"Please use this command in the bot channel"
"Please use this command in the bot channel",
);
}
const embed = await StatsService.userStatsEmbed(interaction);
Expand Down
4 changes: 2 additions & 2 deletions src/commands/user/Members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Members {
// if not bot channel, return
if (!BOT_CHANNELS.includes(channel.name))
return await interaction.editReply(
"Please use this command in the bot channel"
"Please use this command in the bot channel",
);
}
// if somehow no guild, return
Expand All @@ -49,7 +49,7 @@ export class Members {

const count = interaction.guild.members.cache.size;
const memberCount = interaction.guild.members.cache.filter(
(member) => !member.user.bot
(member) => !member.user.bot,
).size;
const botCount = count - memberCount;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/user/Top.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class Top {
if (!BOT_CHANNELS.includes(channel.name))
// if not bot channel, return
return await interaction.editReply(
"Please use this command in the bot channel"
"Please use this command in the bot channel",
);
}
const embed = await StatsService.topStatsEmbed(interaction.guildId);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/user/Translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Translate {
type: ApplicationCommandOptionType.String,
})
txt: string,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
// Defer reply if it takes longer than usual
await interaction.deferReply();
Expand Down
4 changes: 2 additions & 2 deletions src/commands/user/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class UserCommand {
type: ApplicationCommandOptionType.User,
})
user: User,
interaction: CommandInteraction
interaction: CommandInteraction,
) {
// get text channel
const channel = (await interaction.channel?.fetch()) as TextChannel;
Expand All @@ -40,7 +40,7 @@ export class UserCommand {
// if not bot channel, return
if (!BOT_CHANNELS.includes(channel.name))
return await interaction.editReply(
"Please use this command in the bot channel"
"Please use this command in the bot channel",
);
}

Expand Down
18 changes: 9 additions & 9 deletions src/elysia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ new Elysia()
}))
.onAfterHandle(({ startTime, clientIP, request }) =>
log(
`[${new Date().toLocaleString("de")}] ${request.method} ${request.url} - Client IP: ${clientIP} - Duration: ${Date.now() - startTime}ms`
)
`[${new Date().toLocaleString("de")}] ${request.method} ${request.url} - Client IP: ${clientIP} - Duration: ${Date.now() - startTime}ms`,
),
)
.derive(({ path }) => {
const matches = path.match(/\/api\/(\d{17,19})/);
Expand All @@ -78,14 +78,14 @@ new Elysia()
} catch (err) {
console.error(err);
throw new InternalServerError(
"An error occurred while verifying users"
"An error occurred while verifying users",
);
}
},
{
response: t.String(),
detail: { operationId: "verifyAllUsers" },
}
},
)
.derive(({ request, path }) => {
if (request.method !== "GET") return { cacheKey: null };
Expand Down Expand Up @@ -119,7 +119,7 @@ new Elysia()
.filter(
(member) =>
member.permissions.has(PermissionsBitField.Flags.MuteMembers) &&
!member.user.bot
!member.user.bot,
)
.sort((a, b) => a.joinedAt!.getTime() - b.joinedAt!.getTime());

Expand All @@ -131,7 +131,7 @@ new Elysia()
const users: (typeof UserSchema.static)[] = [];
for (const [_, member] of staffMembers) {
const roles = memberRoles.filter(
(role) => role.memberId === member?.id
(role) => role.memberId === member?.id,
);
if (roles.length) {
users.push({
Expand All @@ -156,15 +156,15 @@ new Elysia()
response: t.Array(UserSchema),
type: "application/json",
detail: { operationId: "getStaff" },
}
},
)
.get(
"/api/:guildId/news",
async ({ guild }) => {
if (!guild) throw new NotFoundError("Guild not found");

const newsChannel = guild.channels.cache.find((channel) =>
channel.name.toLowerCase().includes("news")
channel.name.toLowerCase().includes("news"),
);

if (!newsChannel) throw new NotFoundError("News channel not found");
Expand Down Expand Up @@ -218,7 +218,7 @@ new Elysia()
response: t.Array(NewsSchema),
type: "application/json",
detail: { operationId: "getNews" },
}
},
)
.listen(3000);

Expand Down
6 changes: 3 additions & 3 deletions src/events/MessageCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class MessageCreate {
channel instanceof ThreadChannel // Type guard
) {
const parentChannel = message.guild?.channels.cache.get(
channel.parentId!
channel.parentId!,
);
if (
parentChannel &&
Expand Down Expand Up @@ -200,14 +200,14 @@ export class MessageCreate {
const channel = (await message.channel.fetch()) as TextChannel;

const replyMsg = await channel.messages.fetch(
message.reference?.messageId
message.reference?.messageId,
);

await message.delete();

channel.send({
content: await translate(
Buffer.from(replyMsg.content, "utf-8").toString()
Buffer.from(replyMsg.content, "utf-8").toString(),
),
allowedMentions: { users: [] },
});
Expand Down
2 changes: 1 addition & 1 deletion src/events/MessageDelete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class MessageDelete {
@On()
async messageDelete([message]: ArgsOf<"messageDelete">, client: Client) {
MessagesService.deleteMessageDb(message);

if (!message.guild) return; // Make sure this is not a DM

MessagesService.saveDeletedMessageHistory(message);
Expand Down
4 changes: 2 additions & 2 deletions src/events/VoiceStateUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export class VoiceStateUpdate {
newVoiceState?.member || (oldVoiceState?.member as GuildMember);
const guild = newVoiceState?.guild || oldVoiceState?.guild;

if (!member || !guild) return;
if (!member || !guild) return;

const memberGuild = await prisma.memberGuild.findFirst({
where: {
memberId: member.id,
Expand Down
Loading

0 comments on commit 786a14e

Please sign in to comment.