import discord
from discord.ext import commands
TOKEN = 'My Token'
command_prefix = '='
bot = commands.Bot(command_prefix = command_prefix)
announcement_channel_set = ""
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
@bot.command()
async def announcement(announcement_channel_set, announcement_text):
if announcement_channel_set == "":
await bot.send(f"@everyone {announcement_text}")
else:
channel = announcement_channel_set
await channel.send(f"@everyone {announcement_text}")
@bot.command()
async def changeannouncementchannel(ctx, change: discord.TextChannel):
global announcement_channel_set
announcement_channel_set = bot.get_channel(change)
await ctx.send(f"Announcement Channel Changed To #{change}")
bot.run(TOKEN)
This is my whole program, what I don't get is why when I change announcement_channel_set as a global variable, it doesn't change the channel I want the announcement to go into when I do =announcement {message}