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

Feature/#95: Prevent channels being misused for bot testing #96

Closed
wants to merge 1 commit into from
Closed

Feature/#95: Prevent channels being misused for bot testing #96

wants to merge 1 commit into from

Conversation

louis-young
Copy link
Member

@louis-young louis-young commented Jun 29, 2021

PR for #95

This pull request helps to prevent channels from being misused for bot testing.

Changes

  • Add a list of channels in which the bot is disabled.
  • Send a direct message to the user prompting them to test bot commands in direct messages.
    • If the user has direct messages from other users disabled on the server, notify them via the channel they triggered the bot command in.

Notes

  • This is my first time ever looking at a Discord bot so please review with extra caution.
  • I had to cast the channel object to a TextChannel to access the name property. I don't like this, but this appears to be standard from what I could find on some Discord.js issues.

@nickserv
Copy link
Member

nickserv commented Jul 8, 2021

I understand the issue and I appreciate the effort, but I think that entirely disabling all bot commands in some channels restricts the usefulness of the bot too much. For example the !gender command is meant to be used as a response to a user misgendering, which can happen in any channel, including random. If you'd like to try, it would be nice to also have a list of commands that specifically get restricted.

@louis-young
Copy link
Member Author

I understand the issue and I appreciate the effort, but I think that entirely disabling all bot commands in some channels restricts the usefulness of the bot too much. For example the !gender command is meant to be used as a response to a user misgendering, which can happen in any channel, including random. If you'd like to try, it would be nice to also have a list of commands that specifically get restricted.

That should be pretty trivial to do, I’ll take a stab in the morning 🙂

@awareness481
Copy link
Contributor

Is accepting the communication commands enough?

Something like this should work imo:

const whitelistedCommands = ["!gender, !xy"];

export const isWhitelistedCommand = (commands: string[]) => {
  return (
    commands.filter(command => whitelistedCommands.includes(command)).length > 0
  );
};
//...
const hasPreventedBotResponse = isBotDisabledInChannel(channelName);
const isNotWhitelisted = !isWhitelistedCommand(command.words)

if (hasPreventedBotResponse && isNotWhitelisted) {
  notifyUserBotResponseWasPrevented(msg, channelName);

  return;
}

@vcarl
Copy link
Member

vcarl commented Dec 29, 2021

Maybe a different approach would be to change how the cooldown works? Right now it's hard coded with a specific duration, we could make it an exponential backoff situation so folks get blocked for longer times if they keep spamming them, with a DM'd message like "it definitely works, you can DM here with no cooldown if you want"

@vcarl
Copy link
Member

vcarl commented Dec 29, 2021

I'm going to close this out, since it's pretty stale (sorry!) and I think a different approach would be more successful. Let me know if you want to talk it through more, I like the spirit of this but don't think this is mergable as-is

@vcarl vcarl closed this Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants