120 lines
3.3 KiB
Python
120 lines
3.3 KiB
Python
import discord
|
|
from discord.ext import commands
|
|
import platform
|
|
|
|
class Utils(commands.Cog):
|
|
def __init__(self, bot):
|
|
self.bot = bot
|
|
|
|
@commands.command(name='ping')
|
|
async def ping(self, ctx):
|
|
"""Check bot latency"""
|
|
latency = self.bot.latency * 1000
|
|
embed = discord.Embed(
|
|
title='🏓 Pong!',
|
|
description=f'Latency: {latency:.2f}ms',
|
|
color=discord.Color.green()
|
|
)
|
|
await ctx.send(embed=embed)
|
|
|
|
@commands.command(name='stats')
|
|
async def stats(self, ctx):
|
|
"""Show bot statistics"""
|
|
embed = discord.Embed(
|
|
title='📊 Bot Statistics',
|
|
color=discord.Color.blue()
|
|
)
|
|
|
|
embed.add_field(
|
|
name='Latency',
|
|
value=f'{self.bot.latency * 1000:.2f}ms',
|
|
inline=True
|
|
)
|
|
|
|
embed.add_field(
|
|
name='Servers',
|
|
value=str(len(self.bot.guilds)),
|
|
inline=True
|
|
)
|
|
|
|
embed.add_field(
|
|
name='Python Version',
|
|
value=platform.python_version(),
|
|
inline=True
|
|
)
|
|
|
|
embed.add_field(
|
|
name='discord.py Version',
|
|
value=discord.__version__,
|
|
inline=True
|
|
)
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
@commands.command(name='invite')
|
|
async def invite(self, ctx):
|
|
"""Get bot invite link"""
|
|
embed = discord.Embed(
|
|
title='🔗 Invite OC Bot',
|
|
description='Use this link to invite the bot to your server:',
|
|
color=discord.Color.blurple()
|
|
)
|
|
|
|
# Generate invite URL with proper permissions
|
|
permissions = discord.Permissions(
|
|
send_messages=True,
|
|
manage_messages=True,
|
|
manage_webhooks=True,
|
|
read_message_history=True,
|
|
embed_links=True
|
|
)
|
|
|
|
invite_url = discord.utils.oauth_url(
|
|
self.bot.user.id,
|
|
permissions=permissions
|
|
)
|
|
|
|
embed.add_field(
|
|
name='Invite Link',
|
|
value=f'[Click here]({invite_url})',
|
|
inline=False
|
|
)
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
@commands.command(name='about')
|
|
async def about(self, ctx):
|
|
"""About the bot"""
|
|
embed = discord.Embed(
|
|
title='🎭 About OC Bot',
|
|
description='A bot for managing and roleplaying as your original characters',
|
|
color=discord.Color.purple()
|
|
)
|
|
|
|
embed.add_field(
|
|
name='Features',
|
|
value='✅ Create and manage original characters\n'
|
|
'✅ Send messages as your characters\n'
|
|
'✅ Customize avatars and descriptions\n'
|
|
'✅ User-specific triggers\n'
|
|
'✅ Full character management',
|
|
inline=False
|
|
)
|
|
|
|
embed.add_field(
|
|
name='Prefix',
|
|
value='`,` (comma)',
|
|
inline=False
|
|
)
|
|
|
|
embed.add_field(
|
|
name='Help',
|
|
value='Use `,help` to get started',
|
|
inline=False
|
|
)
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
async def setup(bot):
|
|
await bot.add_cog(Utils(bot))
|