Answer the question
In order to leave comments, you need to log in
How to send a mailout to all servers that have a bot?
@bot.command(aliases = ['рассылка',"р","ссылка"])
async def rassilka(ctx ):
if ctx.author.id == мой id:
embed = discord.Embed(title="",description=f"", colour=discord.Colour.blue())
embed.add_field(name=f"", value="", inline=True)
for guild in bot.guilds:
print(f"{guild} - not ready")
random_chan = guild.channels
chenel = random.choice(random_chan)
await chenel.send("Срочная инфа")
await chenel.send(embed =embed)
print(f"{guild} - ready")
Command raised an exception: AttributeError: 'CategoryChannel' object has no attribute 'send'
Answer the question
In order to leave comments, you need to log in
You were clearly pointed out in the error. AttributeError: 'CategoryChannel' object has no attribute 'send' , i.e. The "CategoryChannel" object does not contain a "send" attribute. The guild.channels variable contains the channel categories. You need to get text channels from the category.
@bot.command(aliases = ['рассылка',"р","ссылка"])
async def rassilka(ctx ):
if ctx.author.id == мой id:
embed = discord.Embed(title="",description=f"", colour=discord.Colour.blue())
embed.add_field(name=f"", value="", inline=True)
for guild in bot.guilds:
print(f"{guild} - not ready")
random_chan = [ch for ch in guild.channels if ch.type == discord.ChannelType.text]
chenel = random.choice(random_chan)
await chenel.send("Срочная инфа")
await chenel.send(embed =embed)
print(f"{guild} - ready")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question