Files
bot.py
config.json
mommy_cog.py
mommy_responses.py
requirements.txt
Code
10 843
/home/user/MommyBot/bot.py
import discord
from discord.ext import commands
import os
import json
import logging
from dotenv import load_dotenv
logging.basicConfig(level=logging.INFO)
load_dotenv()
with open("config.json", "r") as f:
config = json.load(f)
TOKEN = os.getenv("DISCORD_TOKEN")
PREFIX = config.get("prefix", "'")
BOT_NAME = config.get("bot_name", "Mommy")
DEVELOPER = config.get("developer", "TSGOD")
# OpenAI setup
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") or config.get("openai_api_key", "")
intents = discord.Intents.all()
bot = commands.Bot(command_prefix=PREFIX, intents=intents, help_command=None)
@bot.event
async def on_ready():
print(f"\n{'='*50}")
print(f"💋 MommyBot is READY!")
print(f"📛 Name: {bot.user.name}")
print(f"🆔 ID: {bot.user.id}")
print(f"👨💻 Developer: {DEVELOPER}")
print(f"🌐 Prefix: {PREFIX}")
print(f"🤖 OpenAI: {'Connected ✅' if OPENAI_API_KEY else 'Not configured ⚠️'}")
print(f"📡 Servers: {len(bot.guilds)}")
print(f"{'='*50}\n")
await bot.change_presence(
activity=discord.Activity(
type=discord.ActivityType.watching,
name=f"over all my babies | {PREFIX}help | TSGOD"
),
status=discord.Status.online
)
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
pass
elif isinstance(error, commands.MissingPermissions):
await ctx.send("You don't have permission to use this command, baby. Ask mommy nicely 😘")
else:
logging.error(f"Command error: {error}")
await ctx.send("Mommy had a little trouble processing that... try again, baby? 💋")
async def load_extensions():
await bot.load_extension("cogs.mommy_cog")
async def main():
if not TOKEN or TOKEN == "your_discord_bot_token_here":
print("❌ ERROR: No DISCORD_TOKEN found in .env file!")
print("📝 Create a .env file with: DISCORD_TOKEN=your_token_here")
return
async with bot:
await load_extensions()
await bot.start(TOKEN)
if __name__ == "__main__":
import asyncio
asyncio.run(main())