/[sudobot]/trunk/src/client/Client.ts
ViewVC logotype

Annotation of /trunk/src/client/Client.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 227 - (hide annotations)
Mon Jul 29 17:29:07 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 3862 byte(s)
feat(automod): auto mute on rejoin (#40)
1 rakin 51 import { Client, ClientOptions, Collection, Interaction, Message } from 'discord.js';
2     import BaseEvent from '../utils/structures/BaseEvent';
3     import BaseCommand from '../utils/structures/BaseCommand';
4     import { Config } from './Config';
5     import Database from './Database';
6     import path from 'path';
7     import Logger from '../automod/Logger';
8     import SnippetManager from '../services/SnippetManager';
9     import AFKEngine from '../services/AFKEngine';
10     import Auth from '../services/Auth';
11     import MessageFilter from '../automod/MessageFilter';
12     import AntiRaid from '../automod/AntiRaid';
13     import Starboard from '../services/Starboard';
14     import Server from '../api/Server';
15 rakin 54 import Cooldown from '../automod/Cooldown';
16 rakin 58 import StartupManager from '../services/StartupManager';
17 rakin 65 import AutoClear from '../automod/AutoClear';
18 rakin 71 import RandomStatus from '../services/RandomStatus';
19 rakin 77 import DebugLogger from '../services/DebugLogger';
20     import BaseCLICommand from '../utils/structures/BaseCLICommand';
21 rakin 81 import discordModals from 'discord-modals';
22 rakin 85 import SpamFilter from '../automod/SpamFilter';
23 rakin 127 import Verification from '../services/Verification';
24 rakin 199 import Welcomer from '../services/Welcomer';
25 rakin 225 import Antijoin from '../automod/Antijoin';
26 rakin 227 import Automute from '../automod/Automute';
27 rakin 51
28     export default class DiscordClient extends Client {
29     private _commands = new Collection<string, BaseCommand>();
30 rakin 77 private _cliCommands = new Collection<string, BaseCLICommand>();
31 rakin 51 private _events = new Collection<string, BaseEvent>();
32    
33     rootdir: string;
34     msg: Message | Interaction | null = null;
35    
36     config: Config;
37     db: Database;
38     logger: Logger;
39     snippetManager: SnippetManager;
40     afkEngine: AFKEngine;
41     auth: Auth;
42     spamFilter: SpamFilter;
43     messageFilter: MessageFilter;
44     antiraid: AntiRaid;
45     starboard: Starboard;
46     server: Server;
47 rakin 54 cooldown: Cooldown;
48 rakin 58 startupManager: StartupManager;
49 rakin 65 autoClear: AutoClear;
50 rakin 71 randomStatus: RandomStatus;
51 rakin 77 debugLogger: DebugLogger;
52 rakin 127 verification: Verification;
53 rakin 199 welcomer: Welcomer;
54 rakin 225 antijoin: Antijoin;
55 rakin 227 automute: Automute;
56 rakin 51
57     static client: DiscordClient;
58    
59     constructor(options: ClientOptions, rootdir: string = __dirname) {
60     super({
61     ws: {
62 rakin 85 properties: {
63 rakin 225 browser: "Discord iOS"
64 rakin 51 }
65     },
66     ...options
67     });
68 rakin 85
69     console.log('init');
70 rakin 51
71     this.rootdir = rootdir;
72 rakin 85
73     DiscordClient.client = this;
74 rakin 51
75     this.config = new Config(this);
76     this.db = new Database(path.resolve(rootdir, 'database.db'), this);
77     this.logger = new Logger(this);
78     this.snippetManager = new SnippetManager(this);
79     this.afkEngine = new AFKEngine(this);
80     this.auth = new Auth(this);
81     this.spamFilter = new SpamFilter(this);
82     this.messageFilter = new MessageFilter(this);
83     this.antiraid = new AntiRaid(this);
84     this.starboard = new Starboard(this);
85     this.server = new Server(this);
86 rakin 54 this.cooldown = new Cooldown(this);
87 rakin 58 this.startupManager = new StartupManager(this);
88 rakin 65 this.autoClear = new AutoClear(this);
89 rakin 71 this.randomStatus = new RandomStatus(this);
90 rakin 77 this.debugLogger = new DebugLogger(this);
91 rakin 127 this.verification = new Verification(this);
92 rakin 199 this.welcomer = new Welcomer(this);
93 rakin 225 this.antijoin = new Antijoin(this);
94 rakin 227 this.automute = new Automute(this);
95 rakin 51
96 rakin 85 discordModals(this);
97 rakin 51 }
98    
99     get commands(): Collection<string, BaseCommand> {
100     return this._commands;
101     }
102    
103 rakin 77 get cliCommands(): Collection<string, BaseCLICommand> {
104     return this._cliCommands;
105     }
106    
107 rakin 51 get events(): Collection<string, BaseEvent> {
108     return this._events;
109     }
110    
111     setMessage(msg: Message | Interaction) {
112     this.msg = msg;
113     }
114     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26