Skip to content

Commit

Permalink
Error with /proxy where it will sometimes send duplicates of each oth…
Browse files Browse the repository at this point in the history
…er, embed sometimes reports the incorrect number
  • Loading branch information
MotorTruck1221 committed Nov 27, 2022
1 parent 794c0e7 commit 319919f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions commands/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ module.exports = {
let random;
function rand() { random = unique[Math.floor(Math.random() * unique.length)]; }
rand();
// console.log(random);
// get the number of uses from the database
let uses = idofuser[0].numberofuses;
if (uses === guild[0].usesallowed) {
Expand Down Expand Up @@ -203,11 +202,21 @@ module.exports = {
});
let lastlink = lastusedlink[0].link;
// if the link numbers are less than 0, set the last link used to none
if (lastlink < 0) {
// if (link.length > 1) {
// // set the lastlink to none with pocketbase
// const update = await pdb.collection('linkused').update( usedlink[0].id, {
// link: 'none',
// });
// }
// console.log('link')
// console.log(link.length)
// if link.length is 1, set the last link to none
console.log('link')
console.log(link.length)
if (link.length == 1) {
// set the lastlink to none with pocketbase
const update = await pdb.collection('linkused').update( usedlink[0].id, {
link: 'none',
});
link = 'none';
rand();
}
if (lastlink === 'none') {
// update the used link
Expand Down

0 comments on commit 319919f

Please sign in to comment.