Spaces:
Paused
Paused
| import discord | |
| from discord import app_commands | |
| from fastapi import FastAPI | |
| import uvicorn | |
| import asyncio | |
| import os | |
| from shared import user_cash, user_bets, fetch_nhl_scores | |
| from petsimgo import petsimgo | |
| from petroll import petroll | |
| from cash import cash | |
| from dice import dice | |
| from admincash import admincash | |
| from shop import shop | |
| from cashapp import cashapp | |
| from database import database | |
| from sportbet import sportbet | |
| from roulette import roulette | |
| # Initialize FastAPI and Discord client | |
| app = FastAPI() | |
| intents = discord.Intents.default() | |
| intents.message_content = True | |
| bot = discord.Client(intents=intents) | |
| tree = app_commands.CommandTree(bot) | |
| # Environment variable for token | |
| TOKEN = os.getenv("token") | |
| async def read_root(): | |
| return {"Hello": "World"} | |
| # Add commands to the command tree | |
| tree.add_command(petsimgo) | |
| tree.add_command(petroll) | |
| tree.add_command(cash) | |
| tree.add_command(dice) | |
| tree.add_command(admincash) | |
| tree.add_command(shop) | |
| tree.add_command(cashapp) | |
| tree.add_command(database) | |
| tree.add_command(sportbet) | |
| tree.add_command(roulette) | |
| async def on_ready(): | |
| await tree.sync() | |
| print(f"{bot.user} is now online!") | |
| async def run_bot(): | |
| if not TOKEN: | |
| raise ValueError("No Discord token found. Please set the DISCORD_TOKEN environment variable.") | |
| await bot.start(TOKEN) | |
| async def startup_event(): | |
| asyncio.create_task(run_bot()) | |
| if __name__ == "__main__": | |
| uvicorn.run("app:app", host="0.0.0.0", port=7860) |