question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Stats command total messages broken

See original GitHub issue

The problem:

The stats command has a field for Total Messages and since 06/05/2020 this field has reported total messages as 0 This might be a consequence of EddieBot not having read perms in all channels of the discord server.

Expected behaviour:

expected

Current Behaviour:

Screenshot 2020-12-05 at 12 58 30 PM

Potential fixes:

1- Give eddiebot admin perms(not recommended IMHO) OR 2- Give eddiebot “Read Message History” access to all the channels OR 3- Refactor the ^stats command(stats.service.ts) to account for the scenario where EddieBot doesn’t have read perms to a channel and tries fetching the channel messages. https://github.com/EddieJaoudeCommunity/EddieBot/blob/f07f2ed3cf49738d704cbcd010be3a9ff6fbc612/src/commandHandlers/stats.service.ts#L46-L59

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:19 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
eddiejaoudecommented, Dec 28, 2020

Oh, thanks for testing.

Can you update your list of options with what has been tried and if it did not work, something like

Possible solution Tested Fixed
Give eddiebot admin perms(not recommended IMHO) 🚫
Give eddiebot “Read Message History” access to all the channels - -
Refactor the ^stats command(stats.service.ts) to account for the scenario where EddieBot doesn’t have read perms to a channel and tries fetching the channel messages. - -
1reaction
BOLT04commented, Dec 19, 2020

@Vyvy-vi yes I think something like that would work.

Something like this:

import { Client, TextChannel, Channel, Permissions } from 'discord.js';
//...
const botUser = this.discordClient.user;
const messagePromises = this.discordClient.channels.cache 
       .filter((ch: Channel) => ch instanceof TextChannel && channel.permissionsFor(botUser).has(Permissions.FLAGS.VIEW_CHANNEL))
       .map((channel: TextChannel) => channel.messages.fetch());

I’m just not sure if const botUser = this.discordClient.user; is how you get the object that represents the bot user 🤔.

Also, I found this and it might be a cool link to add to the documentation resources on our README: https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/frequently-asked-questions.md. What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

BUG: Stats command total messages broken · Issue #360
The problem: The stats command has a field for Total Messages and since 06/05/2020 this field has reported total messages as 0
Read more >
Scoreboard bug and broken command perms | Badlion
I know that for S15 the FFA is being reworked, I just wanted to make sure this is a known bug. https://gyazo.com/a04ed7fdf08d6d9d60015221be505ac0 -...
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
Bug :2 - "How do I attach an ebuild. ... Bug:125 - "man is broken" status:RESOLVED resolution:FIXED severity:normal · Bug:126 - "libefs.pc installed...
Read more >
Reading bug reports | Android Open Source Project
The following sections detail bug report components, describe common problems, and give helpful tips and grep commands for finding logs ...
Read more >
How we spent two weeks hunting an NFS bug in the Linux ...
The full error message read, fatal: Couldn't read ./packed-refs: Stale file handle . · The error seemed to start when they started a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found