/[sudobot]/branches/2.x/src/services/AutoRole.ts
ViewVC logotype

Annotation of /branches/2.x/src/services/AutoRole.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: 612 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 rakinar2 577 import { Guild, GuildMember } from "discord.js";
2     import DiscordClient from "../client/Client";
3    
4     export default async function autoRole(client: DiscordClient, member: GuildMember) {
5     const config = client.config.props[member.guild!.id].autorole;
6    
7     if (config.enabled) {
8     for await (const roleID of config.roles) {
9     try {
10     const role = await member.guild.roles.fetch(roleID);
11    
12     if (role) {
13     await member.roles.add(role);
14     }
15     }
16     catch (e) {
17     console.log(e);
18     }
19     }
20     }
21     };

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26