У меня есть дискорд-бот, но он имеет доступ ко всем чатам на сервере ,как можно его ограничить, чтобы он имел доступ только одному чату?
Вот код бота:
import asyncio
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_message(message):
if int(message.channel.id) != 818865123204005899:
return
@bot.event
async def on_message(message):
if message.author == bot.user:
return
content = message.content
await send(content, message.channel.id)
await message.delete()
await bot.process_commands(message)
async def send_msg(channel_id, msg):
channel = bot.get_channel(channel_id)
await channel.send(msg)
async def send(what, where):
asyncio.run_coroutine_threadsafe(send_msg(where, what), bot.loop)
bot.run()