import os import inspect import discord from discord.ext import commands from discord.ext.commands.errors import ExtensionNotLoaded, ExtensionFailed from discord.ext.commands import Context from customfunctions import config, master_logger, ErrorHandling embedcolor = config("embedcolor") logger = master_logger.getChild("cogs") class CogsCog(commands.Cog, name="Cogs"): def __init__(self, bot): self.bot: discord.Client = bot @commands.command() @commands.is_owner() async def reload(self, ctx: Context, *cogs_to_reload): def format_cog_name(cog_name: str) -> str: return cog_name.replace('cogs.', '').replace('_', ' ').title().replace('.', '/') cog_text_lines = [] if len(cogs_to_reload) == 0: reload_cogs = [ inspect.getmodule(cog).__name__ for cog in self.bot.cogs.values() ] else:
import discord from discord.ext import commands from customfunctions import config, MinecraftApi, master_logger, EmbedMaker, DBManager embedcolor = config("embedcolor") logger = master_logger.getChild("minecraft") database = DBManager.Database() class MinecraftCog(commands.Cog, name="Minecraft"): def __init__(self, bot): self.bot:discord.Client = bot @commands.group(aliases=["mc"]) async def minecraft(self, ctx): if ctx.invoked_subcommand is None: subcommands = [ f'**`{cmd.name}`:** {cmd.help}' for cmd in ctx.command.commands] embed = discord.Embed(color=embedcolor, title="Minecraft Subcommands:", description="\n\n".join(list(map(str, subcommands)))) await ctx.reply(embed=embed) @minecraft.command() async def skin(self, ctx, username:str): """Shows a 3D render of a user's skin""" try: user = MinecraftApi.MinecraftUser(username) except ValueError: await ctx.reply("Invalid username") return embed = discord.Embed(title=user.name,color=embedcolor)
import asyncio import json from types import CoroutineType, coroutine from typing import Coroutine import discord import inspect from discord.ext import commands from discord.ext.commands.converter import Greedy from disputils import BotEmbedPaginator from customfunctions import EmbedMaker, CustomChecks from customfunctions import config from customfunctions import TimeUtils from customfunctions import master_logger logger = master_logger.getChild("utility") embedcolor = config("embedcolor") class UtilityCog(commands.Cog, name="Utility"): def __init__(self, bot): self.bot: discord.Client = bot @commands.command() async def help(self, ctx, *, command_name: str = None): """Shows information about commands. You can optionally specify a command to see more information""" pages = [] if command_name is None: for cog, cog_data in self.bot.cogs.items(): cog: str cog_data: commands.Command
import random import os import requests import discord from discord.ext import commands from customfunctions import del_msg from customfunctions import config, OBJECTS_TO_BONK_WITH, master_logger #region Variable Stuff logger = master_logger.getChild("fun") embedcolor = config("embedcolor") #endregion def simonsays_responses(ctx, content): responses = [ "You can't push me around like that", "You literally typed 11 extra characters to try and get me to do something for you", "Um, no thanks", "I'd reallly rather not say that", "Just say it yourself", "C'mon, just... just remove '%simonsays' and it works", "I am not your speech bot", "You aren't paying me, so no thanks", "I don't work for free", "Make your own simonsays bot", f"{ctx.author.mention} asked me politely to say {content}", "I've always wanted to be a simon" ] return responses class FunCog(commands.Cog, name="Fun"):
startup_lines.append( f'<:Success:865674863330328626> | {format_cog_name(extension)}' ) except Exception as error: startup_lines.append( f'<:Failure:865674863031877663> | {format_cog_name(extension)}' ) for line in traceback.format_exception(type(error), error, error.__traceback__): master_logger.error(line) startup_text = "\n".join(startup_lines) # endregion # region Logger Stuff logger = master_logger.getChild("main") # endregion @bot.event async def on_ready(): logger.info("Bot initialized") await StatusManager.apply_status(bot) startup_channel: discord.TextChannel = bot.get_guild( 797308956162392094).get_channel(867140356424466448) await startup_channel.send(embed=discord.Embed( color=embedcolor, title="Startup", description=startup_text)) bot.owner = (await bot.application_info()).owner bot.prefix = prefix
import datetime import discord from discord.ext import commands from customfunctions import config, DBManager from customfunctions import master_logger, del_msg import inspect # region Variable Stuff logger = master_logger.getChild("testing") embedcolor = config("embedcolor") database = DBManager.Database() # endregion class TestingCog(commands.Cog, name="Testing"): def __init__(self, bot): self.bot: discord.Client = bot self.hide_help = True @commands.command() @commands.cooldown(rate=1, per=300) @commands.is_owner() async def changeinvitehelp(self, ctx, *, contents): channel = self.bot.get_channel(792558439863681046) message = await channel.fetch_message(804147923285573633) embed = discord.Embed(color=embedcolor, description=contents) await message.edit(embed=embed) await ctx.message.add_reaction('✅')
from customfunctions.funcs.checks import IncorrectGuild import datetime import discord from discord.ext import commands from customfunctions import config,DBManager, CustomChecks from customfunctions import master_logger,del_msg # region Variable Stuff logger = master_logger.getChild("adventureous_adventures") embedcolor = config("embedcolor") database = DBManager.Database() # endregion class AACog(commands.Cog, name="Server/Adventurous Adventures"): def __init__(self, bot): self.bot:discord.Client = bot self.guild_limit = 855519898025459782 async def cog_check(self, ctx): enabled = CustomChecks.check_enabled_guild(ctx, self.guild_limit, True) return enabled @CustomChecks.limit_to_guild(764981968579461130) @commands.command() async def server_status(self, ctx): """Gets the status of the Adventureous Adventures server
import datetime as dt import json import time import discord from discord.ext import commands from customfunctions import config, DBManager, EmbedMaker, StatusManager from customfunctions import master_logger #region Variable Stuff embedcolor = config("embedcolor") prefix = config("prefix") database = DBManager.Database() messages_database = DBManager.Database("messages") logger = master_logger.getChild("listeners") delete_logger = master_logger.getChild("listeners").getChild("deletions") #endregion def get_logging_channel(bot: discord.Client, channel_name: str, guild: int = None) -> discord.TextChannel: logging_channels = { "joins": lambda: bot.get_guild(797308956162392094).get_thread( database.cursor.execute( "select join_thread from log_threads where guild_id=?", (guild, )).fetchone()[0]), "invites": lambda: bot.get_guild(797308956162392094).get_thread(
from customfunctions import ConfirmationCheck from customfunctions import EmbedMaker from customfunctions import del_msg from customfunctions import master_logger from customfunctions import StatusManager from cogs.listeners import get_logging_channel #region Variable Stuff BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASE_PATH) BOT_TALK_CHANNEL = None BOT_TALK_CHANNEL_OBJ = None embedcolor = config("embedcolor") logger = master_logger.getChild("owner") statuses={ 0: "Playing", 1: "Streaming", 2: "Listening to", 3: "Watching", 4: "", 5: "Competing in" } #endregion
from customfunctions import master_logger master_logger = master_logger.getChild("servers")