Answer the question
In order to leave comments, you need to log in
Sending messages to a channel by name, not ID // discord.py?
Hello everyone, I want to send moderation logs to a separate channel without specifying the ID of the log channel.
those. not like this:
logshannel = bot.get_channel( conditional log channel ID ) # LOG CHANNEL ID
and something like this:
logschannel = bot.get_channel( channel name ) # LOG CHANNEL NAME
The code itself:
@bot.command()
@commands.has_permissions(administrator=True)
async def kick(ctx, member:discord.Member, reason):
channel = bot.get_channel(************) # ID КАНАЛА ЛОГОВ
embed = discord.Embed( color=0xff0000, title='Kick')
embed.add_field(name='Модератор', value=ctx.message.author.mention)
embed.add_field(name='Пользователь', value=member.mention)
embed.add_field(name='Причина', value=reason)
await member.kick()
await ctx.send(embed=embed)
await channel.send(embed=embed)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question