Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of known bugs #5

Open
LucasB25 opened this issue Dec 6, 2022 · 1 comment
Open

List of known bugs #5

LucasB25 opened this issue Dec 6, 2022 · 1 comment
Labels
Type: bug Something isn't working

Comments

@LucasB25
Copy link
Owner

LucasB25 commented Dec 6, 2022

Bug description

Bot commands no longer work. but the panel can return them

C:\Users\batti\OneDrive\Documents\GitHub\Eagle-Bot-List\src\routes\bots\index.js:85
  let c = botUser.presence.status;
                           ^

TypeError: Cannot read properties of undefined (reading 'status')
    at C:\Users\batti\OneDrive\Documents\GitHub\Eagle-Bot-List\src\routes\bots\index.js:85:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
C:\Users\batti\OneDrive\Documents\GitHub\Eagle-Bot-List\src\routes\api\auth\index.js:16
  if (![bot.owners.primary].concat(bot.owners.additional).includes(req.user.id) && !admin_user_ids.includes(req.user.id)) return res.json({ "success": false, "error": "Bot owner is not user." });
                                                                                    ^

ReferenceError: admin_user_ids is not defined
    at C:\Users\batti\OneDrive\Documents\GitHub\Eagle-Bot-List\src\routes\api\auth\index.js:16:85
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: C:\Users\batti\OneDrive\Documents\GitHub\Eagle-Bot-List\src\dynamic\includes\nav.pug:24
    22|           li.nav-item
    23|             span.hover-grey.nav-link Join Discord
  > 24|         if (req.user && req.user.staff)
    25|           a(style='text-decoration:none!important;', href='/admin')
    26|             li.nav-item
    27|               span.hover-grey.nav-link Review Panel

Cannot read properties of undefined (reading 'user')
@LucasB25 LucasB25 added the Type: bug Something isn't working label Dec 6, 2022
@LucasB25 LucasB25 pinned this issue Dec 6, 2022
@Iinksafe
Copy link

Iinksafe commented Oct 6, 2023

Well, I am unable to reproduce the first and the third error(s), but the second one says that the variable admin_user_ids is not defined, so you should check for its definition in other parts of the code.

As for the first one, you should add a check whether the bot has a presence set or not, example:

// Assuming that `.status` is a `string` object,
// we return an empty string if no presence
// was received or fetched from gateway.
let c = botUser.presence?.status ?? '';

Last but not least, in the third one, you should do the same thing for the first one, example:

if (req?.user?.staff) { ... }

Here, ?. checks whether the variable that is currently being accessed checks whether the variable req (or req.user, if it is accessible) is null or undefined.

Hope this helps! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants