help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
discord-ai-bot
RSK World
discord-ai-bot
Discord AI Bot - Python + discord.py + OpenAI API + AI Bot + Server Management + Moderation
discord-ai-bot
  • __pycache__
  • cogs
  • .env712 B
  • .env.example198 B
  • .gitignore584 B
  • LICENSE1.2 KB
  • README.md1.4 KB
  • bot.py1.7 KB
  • config.py739 B
  • discord-ai-bot.svg1.3 KB
  • discord-ai-bot.zip22.6 KB
  • index.html6.2 KB
  • requirements.txt163 B
  • style.css4.6 KB
GITHUB_RELEASE_GUIDE.mdINSTALL.mdbot.py
bot.py
Raw Download
Find: Go to:
"""
Discord AI Bot - Main Entry Point
Author: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277
Year: 2026
Description: Discord bot with AI capabilities for server management and interactions.
"""

import discord
from discord.ext import commands
import os
import asyncio
from dotenv import load_dotenv
from config import BOT_PREFIX, INITIAL_EXTENSIONS

# Load environment variables
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')

class DiscordAIBot(commands.Bot):
    def __init__(self):
        intents = discord.Intents.all()
        super().__init__(command_prefix=BOT_PREFIX, intents=intents)

    async def setup_hook(self):
        """Initial setup for the bot, loading extensions."""
        for extension in INITIAL_EXTENSIONS:
            try:
                await self.load_extension(extension)
                print(f'Successfully loaded extension: {extension}')
            except Exception as e:
                print(f'Failed to load extension {extension}. Error: {e}')

    async def on_ready(self):
        print(f'Logged in as {self.user} (ID: {self.user.id})')
        print('------')
        await self.change_presence(activity=discord.Game(name=f"AI-Powered | {BOT_PREFIX}help"))

async def main():
    if not TOKEN:
        print("❌ ERROR: DISCORD_TOKEN not found in environment variables!")
        print("Please create a .env file with your DISCORD_TOKEN.")
        return
    
    bot = DiscordAIBot()
    async with bot:
        await bot.start(TOKEN)

if __name__ == "__main__":
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        print("Bot is shutting down...")
    except Exception as e:
        print(f"❌ An error occurred: {e}")
57 lines•1.7 KB
python
🚀 Support RSK World

Subscribe to our YouTube channel for latest tutorials & updates!



Click subscribe & support our work ❤️

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer