/[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 51 by rakin, Mon Jul 29 17:28:23 2024 UTC revision 268 by rakin, Mon Jul 29 17:29:17 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                      await command.run(client, message, {                      const options = {
35                          cmdName,                          cmdName,
36                          args,                          args,
37                          argv: [cmdName, ...args],                          argv: [cmdName, ...args],
38                          normalArgs: args.filter(a => a[0] !== '-'),                          normalArgs: args.filter(a => a[0] !== '-'),
39                          options: args.filter(a => a[0] === '-'),                          options: args.filter(a => a[0] === '-'),
40                          isInteraction: false                          isInteraction: false
41                      } as CommandOptions);                          } as CommandOptions;
42                        
43                        await command.execute(client, message, options);    
44                  }                  }
45                  else {                  else {
46                      await message.reply({                      await message.reply({
# Line 52  export default class MessageCreateEvent Line 55  export default class MessageCreateEvent
55                  return;                  return;
56              }              }
57                            
58              const snippet = await client.snippetManager.get(message.guild!.id, cmdName);              const snippet = await client.snippetManager.getParsed(message.guild!.id, cmdName);
59    
60              if (snippet) {              if (snippet) {                
61                  await message.channel.send({                  try {
62                      content: snippet.content,                      await message.channel.send({
63                      files: snippet.files.map(name => {                          content: snippet.content.trim() === '' ? undefined : snippet.content,
64                          return {                          files: snippet.files.map(name => {
65                              name,                              return {
66                              attachment: path.resolve(__dirname, '../../../storage', name)                                  name,
67                          } as FileOptions                                  attachment: path.resolve(__dirname, '../../../storage', name)
68                      }),                              } as FileOptions
69                  });                          }),
70                            embeds: snippet.embeds
71                        });
72                    }
73                    catch (e) {
74                        console.log(e);                    
75                    }
76    
77                  return;                  return;
78              }              }

Legend:
Removed from v.51  
changed lines
  Added in v.268

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26