/[sudobot]/trunk/src/commands/moderation/WarnCommand.ts
ViewVC logotype

Diff of /trunk/src/commands/moderation/WarnCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 167 by rakin, Mon Jul 29 17:28:51 2024 UTC revision 344 by rakin, Mon Jul 29 17:29:40 2024 UTC
# Line 1  Line 1 
1  import { BanOptions, CommandInteraction, Guild, GuildMember, Interaction, Message, User } from 'discord.js';  import { CommandInteraction, GuildMember, Message, User } from 'discord.js';
2  import BaseCommand from '../../utils/structures/BaseCommand';  import BaseCommand from '../../utils/structures/BaseCommand';
3  import DiscordClient from '../../client/Client';  import DiscordClient from '../../client/Client';
4  import CommandOptions from '../../types/CommandOptions';  import CommandOptions from '../../types/CommandOptions';
# Line 6  import InteractionOptions from '../../ty Line 6  import InteractionOptions from '../../ty
6  import MessageEmbed from '../../client/MessageEmbed';  import MessageEmbed from '../../client/MessageEmbed';
7  import getMember from '../../utils/getMember';  import getMember from '../../utils/getMember';
8  import PunishmentType from '../../types/PunishmentType';  import PunishmentType from '../../types/PunishmentType';
 import History from '../../automod/History';  
9    
10  export async function warn(client: DiscordClient, user: User, reason: string | undefined, msg: Message | CommandInteraction, warned_by?: User) {    export async function warn(client: DiscordClient, user: User, reason: string | undefined, msg: Message | CommandInteraction, warned_by?: User) {  
11      const { default: Punishment } = await import('../../models/Punishment');      const { default: Punishment } = await import('../../models/Punishment');
# Line 18  export async function warn(client: Disco Line 17  export async function warn(client: Disco
17          mod_id: warned_by?.id ?? msg.member!.user.id,          mod_id: warned_by?.id ?? msg.member!.user.id,
18          mod_tag: warned_by?.tag ?? (msg.member!.user as User).tag,          mod_tag: warned_by?.tag ?? (msg.member!.user as User).tag,
19          type: PunishmentType.WARNING,          type: PunishmentType.WARNING,
20            createdAt: new Date()
21      });      });
22    
23      const strike = await Punishment.count({      const strike = await Punishment.count({
24          where: {          guild_id: msg.guild!.id,
25              guild_id: msg.guild!.id,          user_id: user.id,
26              user_id: user.id,          type: PunishmentType.WARNING,
             type: PunishmentType.WARNING,  
         }  
27      });      });
28    
29      // await History.create(user.id, msg.guild!, 'warn', warned_by?.id ?? msg.member!.user.id, reason ?? null);      // await History.create(user.id, msg.guild!, 'warn', warned_by?.id ?? msg.member!.user.id, reason ?? null);

Legend:
Removed from v.167  
changed lines
  Added in v.344

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26