Rapptz / discord.py

An API wrapper for Discord written in Python.
http://discordpy.rtfd.org/en/latest
MIT License
14.72k stars 3.74k forks source link

fetch_message is acting weird on the 2846 members server #4164

Closed SandeQ closed 3 years ago

SandeQ commented 4 years ago

Summary

When i'm trying to use the fetch_message function, it doesn't work on the 2846 members server, but it works on newly created or low (8) members servers

Reproduction Steps

I have a global variable sent_complaint_channel, which store the channel id, where the complaints are stored. In my database, i'm storing the unique complaints ids with their corresponding message ids to edit their embed, in case the complaint was accepted or denied. When executing the command (!deny id reason) i'm getting the messageid from the record with complaintid specified. After getting the messageid, i try to use fetch_message, the problem is that it isn't executing.

I'm not getting any errors in console.

I also double checked the msgid, and the channelid, their values are correct, it is working great on the small servers i mentioned, but on this 2846 members server it isn't.

async def deny(ctx, id, *, reason): global sent_complaints_channel mycursor = mydb.cursor() sql = "SELECT msgid FROM complaintdata WHERE id = %s" val = (id, ) mycursor.execute(sql, val) msgid = mycursor.fetchone() chan = bot.get_channel(sent_complaints_channel) msg = await chan.fetch_message(int(msgid[0])) print(msg) embed = discord.Embed(title='''Skarga została odrzucona''') embed.add_field(name="Administrator który odrzucił skargę", value=ctx.author, inline=True) embed.add_field(name="Powód odrzucenia", value=reason, inline=False) embed.set_image(url='https://i.imgur.com/DaoienM.png') embed.set_footer(text='BloodhuntComplaintBot v1.0.0', icon_url='https://data4.cupsell.pl/upload/generator/247026/640x420/4465398_print_1.png')

await msg.edit(embed = embed)

Expected Results

Message should get fetched, and i should be able to edit the embed in it

Actual Results

The message isn't fetched on the 2846 members server, the code after the fetch_message isn't executing, the console isn't showing any errors

Checklist

System Information

Python version:

Python 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0] on linux

OS version:

PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

library version:

1.3.3

applebee1558 commented 4 years ago

Are you sure it’s the library and not your database blocking? Also on a sidetrack, you probably should use an async library to connect to the database since operations with the default mysql library blocks the thread.

Rapptz commented 3 years ago

This call is entirely pass-through to the Discord API so I'm not sure what's going on here.