ahoys / tunnelerjs

An anti-spam bot for Discord.
MIT License
14 stars 8 forks source link

Help? #5

Closed DirtyTCM closed 5 years ago

DirtyTCM commented 5 years ago

Cant get the bot to execute any command but it config and auth is correct whats the prefix? i tried just typing like ping or reboot nothing happens

ahoys commented 5 years ago

You need to mention the bot, e.g. @Tunneler ping

DirtyTCM commented 5 years ago

only ping seems to work nothing else

DirtyTCM commented 5 years ago

say, antispam about example none of em work besides ping and exit any idea why

ahoys commented 5 years ago

I can think of two possible causes:

First double check that your id is correct in the auth.json file (owner). You can find out your ID by sending the following message to some Discord channel: \@DirtyTCM (replace name with your Discord username) it should return an id which is something like 1234567890123 (all numbers).

Then, check that the command you are trying to use is enabled. To do this, open your server's config file, and make sure the command has enabled: true

Here's an example of ping:

"ping": {
  "enabled": true,
  "access": [
    "owner"
  ]
},

Make sure the "access" part has owner in it, so that you (owner of the bot) are allowed to use the command.

If the config file is missing the entire command, you need to add it manually like above.

ahoys commented 5 years ago

Here's an example for antispam settings:

"antispam": {
  "enabled": true,
  "settings": {
    "warnings": true,
    "punishment": "ban",
    "punishmentRole": "",
    "silentMode": false
  }
}

Notice that middlewares, like antispam, have no commands to trigger them. They are active if the config exists and enabled: true.

Commands and middlewares are two different things. Commands are actions that are triggered by channel commands, e.g. @Tunneler ping and middlewares are something that affect all messages. Like antispam, where the antispam module reads all messages and analyzes them.

DirtyTCM commented 5 years ago

so how do i test if the anti-spam is working

DirtyTCM commented 5 years ago

{ "globalSettings": {}, "strings": { "default": { "keywords": [ "exit", "disconnect" ], "success_0": "ok, see you later!" }, "fi": { "keywords": [ "exit", "poistu" ], "success_0": "löydän itseni ulos." } } }

this is for exit like it doesnt say access owner or anything?

DirtyTCM commented 5 years ago

but yet it works?

DirtyTCM commented 5 years ago

okay i found it, but how can i make a command avaliable for everyone not just me

ahoys commented 5 years ago

Set access to all. For example

"ping": {
  "enabled": true,
  "access": [
    "all"
  ]
},
ahoys commented 5 years ago

The antispam should be working if it is enabled for the guild, but you could test it by changing its punish setting to warn (so that you don't get kicked out of your server), and then asking someone to spam (to send messages with the same content).

Example:

2.40 PM SomeGuy this is spam
2.40 PM SomeGuy this is spam
2.40 PM SomeGuy this is spam
2.40 PM SomeGuy this is spam
2.40 PM SomeGuy this is spam

The bot should then react, if it has enough permissions. After you know it triggers, change the warn back to what-ever you want.

If I remember correctly, the antispam ignores the owner, so you can either ask your friend or change the owner id temporarily.

Here's a full guild config that I've used in a quite big ChivalryGame Discord server:

{
  "localization": "en",
  "middlewares": {
    "antispam": {
      "enabled": true,
      "settings": {
        "punishment": [
          "warn",
          "ban"
        ],
        "punishmentRole": "",
        "cyclePunishments": true,
        "silentMode": false
      },
      "excluded_authors": [
        "106724343513387008"
      ]
    }
  },
  "commands": {
    "ping": {
      "enabled": true,
      "access": [
        "owner"
      ]
    },
    "exit": {
      "enabled": false,
      "access": [
        "owner"
      ]
    },
    "version": {
      "enabled": true,
      "access": [
        "owner"
      ]
    },
    "reboot": {
      "enabled": false,
      "access": [
        "owner"
      ]
    },
    "uptime": {
      "enabled": true,
      "access": [
        "owner"
      ]
    },
    "chivalry": {
      "enabled": true,
      "access": [
        "all"
      ]
    }
  }
}

In middlewares.antispam.settings.punishment the warn, ban means that the bot will first warn the user and if the user doesn't obey, then ban.

You can exclude authors and roles (excluded_authors or excluded_roles), so they won't be warned/banned.

DirtyTCM commented 5 years ago

okay thank you, tbh ur like the only author who takes time to respond to people

DirtyTCM commented 5 years ago

whats punishment role? like mute?

DirtyTCM commented 5 years ago

i cant get anti spamm to work

ahoys commented 5 years ago

PunishmentRole is a Discord role that you have on your server. It can be basically anything. Yes, it can mean mute too. PunishmentRole is only relevant if you have "role" set as a punishment.

  1. Create a role in Discord
  2. Add/remove role permissions (like sending messages), in Discord.
  3. Add id of the role to the config file.

You can get the id for example by mentioning it: \@myrole, it should print out the role id.

Can you paste your server config to find out what's wrong with the anti spam? Have you compared it to the config I pasted above?

Make sure the bot has enough permissions to act. I usually give the "administrator" permission, which is basically the "allow anything" -permission.

DirtyTCM commented 5 years ago

it has it

ahoys commented 5 years ago

Could you send your guild config, so I can try to replicate your issue? Also, have you altered antispam's settings in mw.antispam/middleware.json? (you shouldn't, before you get even just the default settings to work).

DirtyTCM commented 5 years ago

no i havent

DirtyTCM commented 5 years ago

{ "localization": "en", "middlewares": { "antispam": { "enabled": true, "settings": { "warnings": true, "punishment": "warn", "punishmentRole": "524890659119693834", "silentMode": false } } }, "commands": { "ping": { "enabled": true, "access": [ "everyone" ] }, "exit": { "enabled": true, "access": [ "owner" ] }, "reboot": { "enabled": true, "access": [ "owner" ] }, "about": { "enabled": true, "access": [ "everyone" ] } } }

ahoys commented 5 years ago

Some notes:

  1. Access should be "all", not "everyone".
  2. antispam.settings.warning does not exist. SilentMode is what actives the bot to act silently.
  3. Your antispam.settings is missing cyclePunishments

I'm not sure whether any of those should actually prevent antispam from working, but they might. Try to use the config I provided above (copy & paste) and see if that works. If it does, you can then modify it step by step.

ahoys commented 5 years ago

Hey, I just tried myself and I think I've found a solution and a bug. The bug is that the template that the bot creates is invalid. The "punishment" key in the config should actually be "punishments".

The following config worked:

{
  "localization": "en",
  "middlewares": {
    "antispam": {
      "enabled": true,
      "settings": {
        "punishments": [
          "warn"
        ],
        "punishmentRole": "",
        "cyclePunishments": true,
        "silentMode": false
      }
    }
  },
  "commands": {
    "ping": {
      "enabled": true,
      "access": [
        "all"
      ]
    },
    "exit": {
      "enabled": true,
      "access": [
        "owner"
      ]
    },
    "reboot": {
      "enabled": true,
      "access": [
        "owner"
      ]
    },
    "about": {
      "enabled": true,
      "access": [
        "all"
      ]
    }
  }
}

Thank you for having patience for trying the bot out. I wouldn't have noticed the issue otherwise.

ahoys commented 5 years ago

I just released a new version that fixes the invalid guild template. https://github.com/ahoys/tunnelerjs/archive/v.0.11.2.zip

You can now remove your guild folder (the one with 123123123123 name), and make the Tunneler to regenerate it on re-start.

DirtyTCM commented 5 years ago

anytime thank you so much for your help!

DirtyTCM commented 5 years ago

also is theyre a wway to exclude peope from antispam

ahoys commented 5 years ago

Yes! You can exclude both roles and individual users. All you need is either the role id or client id.

    "antispam": {
      "enabled": true,
      "settings": {
        "punishments": [
          "warn"
        ],
        "punishmentRole": "",
        "cyclePunishments": true,
        "silentMode": false
      },
      "excluded_authors": ["1234567891234", "12329340221"],
      "excluded_roles": ["98765432123"]
    }

You can even exclude channels in the same way (excluded_channels).