/[sudobot]/branches/2.x/src/events/guildBan/GuildBanRemoveEvent.ts
ViewVC logotype

Annotation of /branches/2.x/src/events/guildBan/GuildBanRemoveEvent.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (hide annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 972 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 rakinar2 577 import BaseEvent from '../../utils/structures/BaseEvent';
2     import DiscordClient from '../../client/Client';
3     import { GuildBan } from 'discord.js';
4     import Punishment from '../../models/Punishment';
5     import PunishmentType from '../../types/PunishmentType';
6    
7     export default class GuildBanRemoveEvent extends BaseEvent {
8     constructor() {
9     super('guildBanRemove');
10     }
11    
12     async run(client: DiscordClient, ban: GuildBan) {
13     await client.logger.logUnbanned(ban);
14    
15     const logs = (await ban.guild.fetchAuditLogs({
16     limit: 1,
17     type: 'MEMBER_BAN_REMOVE',
18     })).entries.first();
19    
20     console.log(logs?.executor);
21    
22     await Punishment.create({
23     type: PunishmentType.UNBAN,
24     user_id: ban.user.id,
25     guild_id: ban.guild!.id,
26     mod_id: logs?.executor?.id ?? client.user!.id,
27     mod_tag: logs?.executor?.tag ?? 'Unknown',
28     reason: undefined
29     });
30     }
31     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26