thedevs-network / the-guard-bot

The Guard, a Telegram bot to moderate groups.
https://t.me/thedevs_bot
GNU Affero General Public License v3.0
491 stars 162 forks source link

Weird issue with the bot #122

Closed Mrs-Feathers closed 4 years ago

Mrs-Feathers commented 4 years ago

So the first error is saying it doesn't like the group because its a supergroup... and the second error says it can't use a certain command because its NOT a supergroup.... however the bot automatically bans someone i'm trying to unban.... i need this to work. how can i make it work?

TelegramError: 400: Bad Request: group chat was upgraded to a supergroup chat
    at /app/node_modules/telegraf/core/network/client.js:281:17
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 1)
    at nowarnsHandler (/app/handlers/commands/nowarns.js:46:3)
    at removeCommandsHandler (/app/handlers/middlewares/removeCommands.js:22:2)
    at async Promise.all (index 0) {
  code: 400,
  response: {
    ok: false,
    error_code: 400,
    description: 'Bad Request: group chat was upgraded to a supergroup chat',
    parameters: { migrate_to_chat_id: -1001201784679 }
  },
  description: 'Bad Request: group chat was upgraded to a supergroup chat',
  parameters: { migrate_to_chat_id: -1001201784679 },
  on: {
    method: 'unbanChatMember',
    payload: { chat_id: -364298668, user_id: 183356440 }
  }
}
TelegramError: 400: Bad Request: method is available for supergroup and channel chats only
    at /app/node_modules/telegraf/core/network/client.js:281:17
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 4)
    at unbanHandler (/app/handlers/commands/unban.js:39:2)
    at removeCommandsHandler (/app/handlers/middlewares/removeCommands.js:22:2)
    at async Promise.all (index 0) {
  code: 400,
  response: {
    ok: false,
    error_code: 400,
    description: 'Bad Request: method is available for supergroup and channel chats only'
  },
  description: 'Bad Request: method is available for supergroup and channel chats only',
  parameters: {},
  on: {
    method: 'unbanChatMember',
    payload: { chat_id: -246215113, user_id: 183356440 }
  }
}
TelegramError: 400: Bad Request: method is available for supergroup and channel chats only
    at /app/node_modules/telegraf/core/network/client.js:281:17
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 0)
    at unbanHandler (/app/handlers/commands/unban.js:39:2)
    at removeCommandsHandler (/app/handlers/middlewares/removeCommands.js:22:2)
    at async Promise.all (index 0) {
  code: 400,
  response: {
    ok: false,
    error_code: 400,
    description: 'Bad Request: method is available for supergroup and channel chats only'
  },
  description: 'Bad Request: method is available for supergroup and channel chats only',
  parameters: {},
  on: {
    method: 'unbanChatMember',
    payload: { chat_id: -293457926, user_id: 183356440 }
  }
}
wojpawlik commented 4 years ago

Fixed one of the errors.

To work around the second, stop the bot, delete the line with the problematic group (-364298668) from data/Group.db, start the bot and re-add it to the group. cc @C0rn3j