/[sudobot]/trunk/src/commands/automation/BallotCommand.ts
ViewVC logotype

Diff of /trunk/src/commands/automation/BallotCommand.ts

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

revision 59 by rakin, Mon Jul 29 17:28:25 2024 UTC revision 328 by rakin, Mon Jul 29 17:29:34 2024 UTC
# Line 84  export default class BallotCommand exten Line 84  export default class BallotCommand exten
84          });          });
85    
86          await ballot.save();          await ballot.save();
87            
         // await client.db.runAsync('INSERT INTO ballots(content, author, msg_id, guild_id, date, channel_id) VALUES(?, ?, ?, ?, ?, ?)', [content, anonymous ? null : msg.member?.user.id, message.id, msg.guild!.id, new Date().toISOString(), msg.channel!.id]);  
         // const ballot = await client.db.getAsync("SELECT * FROM ballots WHERE msg_id = ? AND guild_id = ? ORDER BY id DESC LIMIT 0, 1", [message.id, msg.guild!.id]);  
   
88          await message.react(<EmojiIdentifierResolvable> await fetchEmoji('check'));          await message.react(<EmojiIdentifierResolvable> await fetchEmoji('check'));
89          await message.react(<EmojiIdentifierResolvable> await fetchEmoji('error'));          await message.react(<EmojiIdentifierResolvable> await fetchEmoji('error'));
90    
# Line 110  export default class BallotCommand exten Line 107  export default class BallotCommand exten
107          }          }
108                    
109          try {          try {
110              const id = options.isInteraction ? options.options.getInteger('id') : options.args[0];              const id = options.isInteraction ? options.options.getString('id') : options.args[0];
111              //const ballot = await client.db.getAsync("SELECT * FROM ballots WHERE id = ? ORDER BY id DESC LIMIT 0, 1", [id]);              //const ballot = await client.db.getAsync("SELECT * FROM ballots WHERE id = ? ORDER BY id DESC LIMIT 0, 1", [id]);
112              const ballot = (await Ballot.findOne({              const ballot = await Ballot.findById(id);
                 where: {  
                     id  
                 }  
             }))?.get();  
113    
114              if (!ballot)              if (!ballot)
115                  throw new Error();                  throw new Error();

Legend:
Removed from v.59  
changed lines
  Added in v.328

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26