Sending a message to a channel with cooldown enabled doesn't work nor does it raise an error
See original GitHub issueSummary
So basically, if you try bot.fetch_channel() then try to send a message to that channel, WHILE from the client you can’t send a message because of the cooldown, it’s not gonna work, and it’s not gonna raise an error
Reproduction Steps
I was trying to automate the process of sending messages to multiple channels, their IDs were stored as integers in a list. I looped over the list and tried fetching the channel and sending a message to it, and it happened that the first ID in the list was an ID of a channel that I had already sent a message to before, but I wanted to use it as a test, basically, if I put it in a try/except block, and I wanted to send a message to the channel, and print an error message if I faced an error, but it didn’t even print, and the message was NOT sent. I removed it out of the try/except block, nothing changed, no error was raised. All the indentation was valid, I had no errors in the code and everything was defined as well.
Code
example_list = [channel_id_1, channel_id_2]
# channel_id_1 is an ID of a channel that you cannot send a message to in the client due to cooldown
# channel_id_2 is an ID of a channel that you can send a message to
# Results are the same inside of commands and events
for ID in example_list:
try: # Doesn't matter if it was inside or outside of a try/except block
channel = await bot.fetch_channel(ID)
except:
# something
pass
else:
try: # Doesn't matter if it was inside or outside of a try/except block
await channel.send("any message") # Doing await ctx.send(channel) works, only channel.send doesn't work and it doesn't raise an exception/error
except:
# something
pass
# now it'll stop the whole for loop, not even continue to the next ID in the list.
Expected Results
Send a message and if it failed, raise an exception.
Actual Results
Weirdly stops and doesn’t raise an exception.
System Information
- Python v3.10.1-final
- discord.py-self v1.9.1-final
- aiohttp v3.7.4.post0
- system info: Windows 10 10.0.19042
Checklist
- I have searched the open issues for duplicates.
- I have shared the entire traceback.
- I am using a user token (and it isn’t visible in the code).
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Shouldn’t there be something like a print statement that makes it clear for people or something? Also what’s a proper way of achieving my goal if that’s what the library is going to do?
@dolfies why is this issue still open, it’s usually common practice to close issues if there’s nothing more to add. Comments can still be added to close issues, and reopened if it was closed by the author themselves.