Однако я не могу отправить сообщение на канал. Я попробовал этот код:
Код: Выделить всё
import discord
import os
import random
import asyncio
testing_servers = # list of server ids
intents = discord.Intents().all()
bot = discord.Bot(intents=intents)
@bot.slash_command(guild_ids=testing_servers, name="announce", description="Make server announcements!")
async def announce(ctx, title, text, channel_id,anonymous=None):
#response embed
print(channel_id)
#announcement embed
embed_announce = discord.Embed(
colour = discord.Colour.blue(),
title=str(title),
description = text
)
await bot.get_channel(channel_id).send(embed = embed_announce)
Я делаю вывод, что bot.get_channel(channel_id) имеет значение None. Но почему? Как мне выбрать правильный канал для отправки сообщения?
Подробнее здесь: https://stackoverflow.com/questions/715 ... e-nonetype
Мобильная версия