mrjackyliang / discord-stonker-bot

An advanced business-ready bot built for finance-related Discord servers
MIT License
11 stars 1 forks source link

Duplicate Avatar feature #4

Closed bxpana closed 1 year ago

bxpana commented 1 year ago

Is the duplicate Avatar feature gone since Discord updated?

mrjackyliang commented 1 year ago

Discord never had a duplicate avatar feature natively. The bot still has it btw.

bxpana commented 1 year ago

Where is the feature? I see !duplicates as a command but doesn't seem to do anything when I run it

mrjackyliang commented 1 year ago

Is the configuration set correctly? If the configuration isn't set for the server tools, specifically the fetch duplicates settings, the command won't work.

bxpana commented 1 year ago

I'll check that out and reopen if I can't get it working. Thank you

mrjackyliang commented 1 year ago

Sure thing!

bxpana commented 1 year ago

@mrjackyliang ok tried it again, started fresh with the config and cloned the current repo. New config is:

{
    "settings": {
      "discord": {
        "token": "Token",
        "guild": {
          "description": "Guild_name",
          "guild-id": "guild_Id"
        }
      },
      "time-zone": "Etc/UTC",
      "log-level": 30,
      "fetch-duplicates": {
        "base-commands": [
          "!duplicates"
        ],
        "delete-message": true,
        "allowed-roles": [
          {
            "description": "Admin",
            "role-id": "role_Id"
          }
        ]
      }

    }
  }

I can get the bot online, but when I run !duplicates I am not getting the list of all my duplicates avatars like I have in the past. What am I missing here?

mrjackyliang commented 1 year ago

Fetch duplicates is in the wrong place. Should be inside server tools last I remember, not the settings object

mrjackyliang commented 1 year ago

Let me get back to you in about an hour and I'll send a full sample of what will enable the bot for you.

mrjackyliang commented 1 year ago

So this is how the config is supposed to look like:

{
  "settings": {
    "discord": {
      "token": "",
      "guild": {
        "description": "",
        "guild-id": ""
      }
    },
    "time-zone": "Etc/UTC",
    "log-level": 30
  }
  "server-tools": {
    "fetch-duplicates": {
      "base-commands": [
        "!duplicates"
      ],
      "delete-message": true,
      "allowed-roles": [
        {
          "description": "Sample role",
          "role-id": "000000000000000000"
        }
      ]
    }
  }
}
bxpana commented 1 year ago

Alright, that seemed to work! There is a comma missing but easily got it fixed. Now the issue is that it's not seeing any of my users. It recognizes all the channels but says there is only 1 member and it should be seeing 130,000 members

bxpana commented 1 year ago

Here is some of the error I see

Server has 1 member and 107 channels ...
2022-11-02 23:21:19 UTC - ERROR - Failed to send message (function: showNoResultsMessage, channel: "<#880572336682696795>", payload: {"embeds":[{"title":"No Results","type":"rich","description":"There are no duplicate users found in the **zkSync** guild.","url":null,"timestamp":"2022-11-02T23:21:19.256Z","color":8421504,"fields":[],"thumbnail":null,"image":null,"author":null,"footer":{"text":"Initiated by bxpana | Never DMs First#0539"}}],"reply":{"messageReference":{"channelId":"880572336682696795","guildId":"722409280497516566","id":"1037506723734364232","createdTimestamp":1667431278881,"type":"DEFAULT","system":false,"content":"!duplicates","authorId":"356281547135123457","pinned":false,"tts":false,"nonce":"1037506722945564672","embeds":[],"components":[],"attachments":[],"stickers":[],"editedTimestamp":null,"webhookId":null,"groupActivityApplicationId":null,"applicationId":null,"activity":null,"flags":0,"reference":null,"interaction":null,"cleanContent":"!duplicates"}}}) ...
{
  name: 'DiscordAPIError',
  message: 'Invalid Form Body\nmessage_reference: Unknown message',
  method: 'post',
  path: '/channels/880572336682696795/messages',
  code: 50035,
  httpStatus: 400,
  requestData: {
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: [Array],
      components: undefined,
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: undefined,
      flags: undefined,
      message_reference: [Object],
      attachments: undefined,
      sticker_ids: undefined
    },
    files: []
  },
mrjackyliang commented 1 year ago

I think I see two errors. For the configuration, try setting delete-message to false and make sure the Discord Application setup is configured correctly.

I remember Discord limits the bot from seeing all the members if that toggle isn't enabled.

bxpana commented 1 year ago

Haha I guess it would help if I read the instructions correctly haha. Ok I'm starting to see good stuff now. It still tells me there is only one member when I do npm start but running the duplicates command is giving me some stuff. It's different and doesn't show what Avatar they have in common (the visual).

Does it need to load information from the server? Each time I do !duplicates it is giving me more duplicates

mrjackyliang commented 1 year ago

The duplicates avatar is based on the hash generated by Discord.

If the hash is different, then the avatars won't be shown under the same group.

This happens when a spammer changes the picture slightly to avoid detection. But that's a really manual process for them and they probably try to avoid it unless someone spamming for them is getting paid a premium to do so.

mrjackyliang commented 1 year ago

And for the members, if it's 1 member, then the toggles in the Discord Developer > Bot should be turned on.

I know this needs to be enabled for members and messages.

bxpana commented 1 year ago

Ok cool everything should be good and working now. Thanks again for the help!

mrjackyliang commented 1 year ago

Sure thing!

github-actions[bot] commented 7 months ago

This issue is now locked and considered resolved. If you have questions or inquiries, you may start a new issue.