Getting channel by ID, to send my embed message to it (PYTHON)

  python

I was able to just use ctx = ctx.get_channel(channel-id), but ever since I put all my code into cogs, I have been getting this error: error. I want to be able to type the command in any channel, and then have it send to the channel I specify

from cgitb import text
import datetime
from unicodedata import name
import discord
from discord.ext import commands


class Announce(commands.Cog):

    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    @commands.has_any_role('Management', 'Owner')
    async def announce(self, ctx, *, message=None):
        if message == None:
            return
        else:
            embed = discord.Embed(
                title="",
                description=message,
                color=0x00f1f1,
                timestamp=datetime.datetime.utcnow()
            )
        embed.set_footer(text='SkyCloud'),
        embed.set_author(name='Announcement')
        await ctx.channel.purge(limit=1)
        await ctx.send(embed=embed)
        await ctx.send('@everyone')
        await ctx.channel.purge(limit=1)


def setup(bot):
    bot.add_cog(Announce(bot))```

Source: Python Questions

LEAVE A COMMENT