so I checked all over in stack overflow for answers and nothing.
Im trying to make it that when the bot fires up it will send a message in a channel, I have alr checked if the bot can see and talk in the channel and they can.
My code:
import discord
from discord.ext import commands
from datetime import datetime
intents = discord.Intents().all()
bot = commands.Bot(command_prefix="!", intents=intents, case_insensitive=True)
client = discord.Client(intents=intents)
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
current_time = datetime.now().strftime("%H:%M:%S")
channel = bot.get_channel('1069075658979954700')
embed = discord.Embed(title="GAH Verification",
description="I have awoken",
color=discord.Color.green())
embed.set_footer(text=current_time)
await channel.send('Hi')
bot.run(
"MTA2OTI2NDQ0MTQwMjcyODU3MQ.GV353u.XXagXFsp3Ax4vRxvt3y5s6P9FPPDrOeMh2M7jI")
Error:
Traceback (most recent call last):
File "/home/runner/GAH-Bot/venv/lib/python3.10/site-packages/discord/client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "main.py", line 19, in on_ready
await channel.send('Hi')
AttributeError: 'NoneType' object has no attribute 'send'