import os
import asyncio
from aiohttp import web
import discord
from discord.ext import commands

TOKEN = os.getenv("MTQwNjcyMDcyNDI2OTI2OTE2Nw.G6PB4W.9CUtrdHepqKIkpFlbAvtvtU-EPAe9EAjjbgpwE"
")
PORT = int(os.getenv("PORT", "8080"))

intents = discord.Intents.default()
intents.message_content = True  # only if you need message content

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

async def health(request):
    return web.Response(text="OK")

async def start_web():
    app = web.Application()
    app.router.add_get("/", health)
    app.router.add_get("/health", health)

    runner = web.AppRunner(app)
    await runner.setup()
    site = web.TCPSite(runner, "0.0.0.0", PORT)
    await site.start()

async def main():
    await start_web()
    await bot.start(TOKEN)

if __name__ == "__main__":
    asyncio.run(main())