/[sudobot]/trunk/src/events/message/MessageCreateEvent.ts
ViewVC logotype

Diff of /trunk/src/events/message/MessageCreateEvent.ts

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

revision 54 by rakin, Mon Jul 29 17:28:24 2024 UTC revision 256 by rakin, Mon Jul 29 17:29:14 2024 UTC
# Line 26  export default class MessageCreateEvent Line 26  export default class MessageCreateEvent
26                  .split(/ +/);                  .split(/ +/);
27                                    
28              const command = await client.commands.get(cmdName);              const command = await client.commands.get(cmdName);
             const allowed = await client.auth.verify(message.member!, cmdName);  
29    
30              if (command && command.supportsLegacy) {              if (command && command.supportsLegacy) {
31                    const allowed = await client.auth.verify(message.member!, command);
32                    
33                  if (allowed) {                  if (allowed) {
34                      const options = {                      const options = {
35                          cmdName,                          cmdName,
# Line 42  export default class MessageCreateEvent Line 43  export default class MessageCreateEvent
43                      if (!await client.cooldown.start(message, options))                      if (!await client.cooldown.start(message, options))
44                          return;                          return;
45                                            
46                      await command.run(client, message, options);                          await command.execute(client, message, options);    
47                  }                  }
48                  else {                  else {
49                      await message.reply({                      await message.reply({
# Line 57  export default class MessageCreateEvent Line 58  export default class MessageCreateEvent
58                  return;                  return;
59              }              }
60                            
61              const snippet = await client.snippetManager.get(message.guild!.id, cmdName);              const snippet = await client.snippetManager.getParsed(message.guild!.id, cmdName);
62    
63              if (snippet) {              if (snippet) {                
64                  await message.channel.send({                  try {
65                      content: snippet.content,                      await message.channel.send({
66                      files: snippet.files.map(name => {                          content: snippet.content.trim() === '' ? undefined : snippet.content,
67                          return {                          files: snippet.files.map(name => {
68                              name,                              return {
69                              attachment: path.resolve(__dirname, '../../../storage', name)                                  name,
70                          } as FileOptions                                  attachment: path.resolve(__dirname, '../../../storage', name)
71                      }),                              } as FileOptions
72                  });                          }),
73                            embeds: snippet.embeds
74                        });
75                    }
76                    catch (e) {
77                        console.log(e);                    
78                    }
79    
80                  return;                  return;
81              }              }

Legend:
Removed from v.54  
changed lines
  Added in v.256

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26