import discord
from discord.ext import commands
from unidecode import unidecode

intents = discord.Intents.default()
intents.typing = False
intents.presences = False

bot = commands.Bot(command_prefix='!', intents=intents)

allowed_channel_id = 1338435701762424832 

@bot.event
async def on_ready():
    print(f'Bot is ready. Logged in as {bot.user}')
    channel = bot.get_channel(allowed_channel_id)
    if channel:
        print(f'Bot is connected to channel: {channel.name}')
    else:
        print(f'Bot is not connected to the allowed channel.')

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return
    
    if message.channel.id == allowed_channel_id and message.content.startswith('!fix'):
        await bot.process_commands(message)

@bot.command()
async def fix(ctx, *, text):
    cleaned_text = remove_diacritics(text)
    response = f'{cleaned_text}'
    await ctx.send(response)

def remove_diacritics(text):
    cleaned_text = unidecode(text) 
    return cleaned_text

bot.run('MTE0MTQwOTAyNjAyMjg0MjM4OA.G_p_lX.LsCjLzmStw4pmM5wZUu4VVgCajSnOpCGj4fbTQ')
