botbotbotbot / app.py
coollsd's picture
Update app.py
6b076a3 verified
raw
history blame
944 Bytes
import discord
from discord import app_commands
import asyncio
from fastapi import FastAPI
import uvicorn
from commands import petsimgo, petroll, cash, dice, admincash
app = FastAPI()
intents = discord.Intents.default()
intents.message_content = True
bot = discord.Client(intents=intents)
tree = app_commands.CommandTree(bot)
@app.get("/")
async def read_root():
return {"Hello": "World"}
tree.add_command(petsimgo.petsimgo)
tree.add_command(petroll.petroll)
tree.add_command(cash.cash)
tree.add_command(dice.dice)
tree.add_command(admincash.admincash)
@bot.event
async def on_ready():
await tree.sync()
print(f"{bot.user} is now online!")
async def run_bot():
await bot.start("MTI5MjkxMDYzMjg3MzQ5MjU4Mw.GbVmvy.8kEhPZyNLrACzBWYEorT7UqNRME7gp6Lvz6lg8")
@app.on_event("startup")
async def startup_event():
asyncio.create_task(run_bot())
if __name__ == "__main__":
uvicorn.run("app:app", host="0.0.0.0", port=7860)