-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed as not planned
Closed as not planned
Copy link
Labels
invalidThis is not right.This is not right.
Description
Summary
Sometimes, when I send messages to channels the bot gets that error, even if the message is not empty.
Reproduction Steps
Create an embed, and send it. This happens sometimes.
(THE REPRODUCIBLE CODE, DOESN'T REPRODUCE THE ERROR ALWAYS)
Minimal Reproducible Code
import discord
from discord import app_commands
import asyncio
SELECTED_BOT_TOKEN = "???"
#Needed intents
class aClient(discord.Client):
def __init__(self) -> None:
super().__init__(intents=discord.Intents.default())
self.synced = False
async def on_ready(self):
await self.wait_until_ready()
await tree.sync()
client = aClient()
tree = app_commands.CommandTree(client)
@tree.command(name="test",description="TEST!")
@app_commands.describe(text="TEST...")
async def fixTranslation(interaction: discord.Interaction, text:str):
await send(interaction.channel,interaction.user)
async def send(configChannel,member):
#Variables
badgeName = "BADGE_NAME"
configDoPing = True
pingText = "<@442706548242907148> ! Yeni bir rozet aldınız!"
description = """<@442706548242907148> **fifa 22** aldı ve şimdi 1 rozeti var!
Bu rozet 6965 üyeye aittir."""
emoji = None
#Embed
e = discord.Embed(title="TITLE_HERE", description=description)
#Add image
imageUrl = "https://dibot.tibi4.com/badges/Server%20Badges/B_68068.png?t=1658908284"
e.set_thumbnail(url=imageUrl)
#Add footer
if emoji is not None:
e.set_footer(text=f"This badge has an emoji! ⟶ {emoji}")
#Send (and edit if needed)
try:
print(f"Sent announcement: {badgeName} (PingText: {pingText is not None})")
announcementMessage = await configChannel.send(content=pingText,embed=e)
if configDoPing:
await asyncio.sleep(5)
await announcementMessage.edit(content=None,embed=e)
except Exception as excep:
print(f"""Variables:
configDoPing = {configDoPing}
pingText = {pingText}
description = {description}
imageUrl = {imageUrl}
emoji = {emoji}
member = {member}
member.guild.id = {member.guild.id}
member.guild.name = {member.guild.name}
""")
print(f"VARIABLES ABOVE!\n{excep}")
client.run(SELECTED_BOT_TOKEN)
Expected Results
The message to be sent successfully.
Actual Results
Error happens, and message not sent.
Intents
discord.Intents.default() (and) intents.presences = True (and) intents.members = True (and) intents.message_content = False
System Information
python3.9 -m discord -v
- Python v3.9.4-final
- discord.py v2.0.0-alpha
- discord.py pkg_resources: v2.0.0a4448+g13c725f1
- aiohttp v3.8.1
- system info: Linux 4.9.0-8-amd64 Fix issue with author changing type #1 SMP Debian 4.9.144-3.1 (2019-02-19)
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
The bot uses that function (send) many times (at least 1 per minute), but this problem happens only sometimes. I can't reproduce the problem always. It happens every 30-60mins.
The configChannel is a TextChannel, and the member is a Member.
Metadata
Metadata
Assignees
Labels
invalidThis is not right.This is not right.