/[sudobot]/trunk/src/App.js
ViewVC logotype

Diff of /trunk/src/App.js

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

revision 10 by rakin, Mon Jul 29 17:28:12 2024 UTC revision 22 by rakin, Mon Jul 29 17:28:15 2024 UTC
# Line 9  const Logger = require("./Logger"); Line 9  const Logger = require("./Logger");
9  const SpamFilter = require("./SpamFilter");  const SpamFilter = require("./SpamFilter");
10  const server = require("./server");  const server = require("./server");
11  const AntiRaid = require("./AntiRaid");  const AntiRaid = require("./AntiRaid");
12    const MessageFilter = require("./MessageFilter");
13    
14  class App {  class App {
15      constructor(rootdir) {      constructor(rootdir) {
# Line 35  class App { Line 36  class App {
36          this.logger = new Logger();          this.logger = new Logger();
37          this.spamFilter = new SpamFilter();          this.spamFilter = new SpamFilter();
38          this.antiRaid = new AntiRaid();          this.antiRaid = new AntiRaid();
39            this.messageFilter = new MessageFilter();
40          this.boot();          this.boot();
41      }      }
42    
# Line 45  class App { Line 47  class App {
47          });          });
48    
49          this.on('messageCreate', async (message) => {          this.on('messageCreate', async (message) => {
50              if (message.author.bot) {              if (message.author.bot || !message.guild || message.channel.type == 'dm') {
51                  return;                  return;
52              }              }
53    
54              await (this.msg = message);              await (this.msg = message);
55                            
56             // await this.spamFilter.start(message);              await this.spamFilter.start(message);
57                await this.messageFilter.start(message, this.commandManager);
58    
59              await this.commandManager.setMessage(message);              await this.commandManager.setMessage(message);
60    
61              const valid = await this.commandManager.valid();              const valid = await this.commandManager.valid();
62              const has = await this.commandManager.has();              const has = await this.commandManager.has();
63              const snippet = await this.commandManager.snippet();              const snippet = await this.commandManager.snippet();
64                const allowed = await this.commandManager.verify();
65                            
66              if (valid && has) {              if (valid && has && allowed) {
67                  await this.exec();                  await this.exec();
68              }              }
69              else if (valid && snippet !== undefined) {              else if (valid && snippet !== undefined) {
# Line 70  class App { Line 74  class App {
74              else if (valid && !has) {              else if (valid && !has) {
75                  await this.commandManager.notFound();                  await this.commandManager.notFound();
76              }              }
77                else if (valid && has && !allowed) {
78                    await this.commandManager.notAllowed();
79                }
80          });          });
81    
82          this.on("messageUpdate", async (oldMessage, newMessage) => {          this.on("messageUpdate", async (oldMessage, newMessage) => {

Legend:
Removed from v.10  
changed lines
  Added in v.22

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26