Ejemplo n.º 1
0
 def __init__(self, bot):
     global gcmds
     self.bot = bot
     self.tasks = []
     gcmds = globalcommands.GlobalCMDS(self.bot)
     self.bot.loop.create_task(self.init_disboard())
     self.check_unsent_reminder.start()
Ejemplo n.º 2
0
 def __init__(self, **kwargs):
     global gcmds
     super().__init__(command_prefix=kwargs['command_prefix'],
                      help_command=kwargs["help_command"],
                      shard_count=kwargs['shard_count'],
                      description=kwargs["description"],
                      fetch_offline_members=kwargs['fetch_offline_members'],
                      status=kwargs['status'],
                      activity=kwargs['activity'],
                      intents=kwargs['intents'])
     self.uptime = kwargs['uptime']
     self.db = kwargs.pop("db")
     gcmds = globalcommands.GlobalCMDS(bot=self)
     func_checks = (self.check_blacklist, self.disable_dm_exec,
                    context.redirect)
     func_listen = (self.on_message, self.on_command_error,
                    self.on_guild_join, self.on_guild_remove,
                    self.on_member_join)
     for func in func_checks:
         self.add_check(func)
     for func in func_listen:
         self.event(func)
     cogs = [
         filename[:-3] for filename in os.listdir('./cogs')
         if filename.endswith(".py")
     ]
     for cog in sorted(cogs):
         self.load_extension(f'cogs.{cog}')
         print(f"Cog \"{cog}\" has been loaded")
     self.loop.create_task(self.init_counters())
     self.loop.create_task(self.all_loaded())
Ejemplo n.º 3
0
 def __init__(self, bot: commands.AutoShardedBot):
     global gcmds
     self.bot = bot
     gcmds = globalcommands.GlobalCMDS(self.bot)
     self.bot.loop.create_task(self.init_logging())
     self.guild_dispatch = logdispatcher.GuildDispatcher(self.bot)
     self.member_dispatch = logdispatcher.MemberDispatcher(self.bot)
Ejemplo n.º 4
0
 def __init__(self, bot):
     global gcmds
     self.bot = bot
     self.messages = {}
     self.update_server_stats.start()
     gcmds = globalcommands.GlobalCMDS(bot=self.bot)
     self.bot.loop.create_task(self.init_requests())
Ejemplo n.º 5
0
 def __init__(self, bot):
     global gcmds, PROHIB_NAMES
     self.bot = bot
     PROHIB_NAMES = [command.name.lower() for command in self.bot.commands]
     for command in self.bot.commands:
         if command.aliases:
             for alias in command.aliases:
                 if not alias.lower() in PROHIB_NAMES:
                     PROHIB_NAMES.append(alias.lower())
     gcmds = globalcommands.GlobalCMDS(self.bot)
     self.bot.loop.create_task(self.init_tags())
Ejemplo n.º 6
0
 def __init__(self, bot):
     global gcmds
     self.bot = bot
     gcmds = globalcommands.GlobalCMDS(self.bot)
Ejemplo n.º 7
0
import random
from datetime import datetime

import discord
import praw
import yaml
from discord.ext import commands
from utils import globalcommands

gcmds = globalcommands.GlobalCMDS()


class Reddit(commands.Cog):
    def __init__(self, bot):
        global gcmds
        self.bot = bot
        gcmds = globalcommands.GlobalCMDS(self.bot)

    async def get_id_secret(self, ctx):
        client_id = gcmds.env_check("REDDIT_CLIENT_ID")
        client_secret = gcmds.env_check("REDDIT_CLIENT_SECRET")
        user_agent = gcmds.env_check("USER_AGENT")
        if not all([client_id, client_secret, user_agent]):
            title = "Missing Reddit Client ID or Client Secret or User Agent"
            description = "Insert your Reddit Client ID, Client Secret, and User Agent in the `.env` file"
            embed = discord.Embed(title=title,
                                  description=description,
                                  color=discord.Color.dark_red())
            await ctx.channel.send(embed=embed)
        return client_id, client_secret, user_agent
Ejemplo n.º 8
0
 def __init__(self, bot: commands.AutoShardedBot):
     global gcmds
     self.bot = bot
     gcmds = globalcommands.GlobalCMDS(self.bot)
Ejemplo n.º 9
0
 def __init__(self, bot):
     global gcmds
     self.bot = bot
     gcmds = globalcommands.GlobalCMDS(self.bot)
     self.bot.loop.create_task(self.init_c4())
Ejemplo n.º 10
0
 def __init__(self, bot: commands.AutoShardedBot):
     global gcmds
     self.bot = bot
     gcmds = globalcommands.GlobalCMDS(self.bot)
     self.bot.loop.create_task(self.init_starboard())
Ejemplo n.º 11
0
 def __init__(self, bot: commands.AutoShardedBot):
     global gcmds
     self.bot = bot
     self.bot.loop.create_task(self.init_nintendo())
     gcmds = globalcommands.GlobalCMDS(self.bot)
Ejemplo n.º 12
0
 def __init__(self, bot):
     global gcmds
     self.bot = bot
     gcmds = globalcommands.GlobalCMDS(self.bot)
     self.bot.loop.create_task(self.init_blacklist())
     self.bot.loop.create_task(self.init_balance())
Ejemplo n.º 13
0
 def __init__(self, bot: commands.AutoShardedBot):
     super().__init__()
     self.bot = bot
     self.min_level = LogLevel.BASIC
     self.gcmds = globalcommands.GlobalCMDS(self.bot)
Ejemplo n.º 14
0
 def __init__(self, bot):
     global gcmds
     self.bot = bot
     self.bot.loop.create_task(self.init_cogs_list())
     gcmds = globalcommands.GlobalCMDS(self.bot)
Ejemplo n.º 15
0
 def __init__(self, bot: commands.AutoShardedBot):
     global gcmds
     self.bot = bot
     self.messages = {}
     self.update_server_stats.start()
     gcmds = globalcommands.GlobalCMDS(bot=self.bot)
Ejemplo n.º 16
0
 def __init__(self, bot):
     global gcmds
     self.bot = bot
     gcmds = globalcommands.GlobalCMDS(self.bot)
     self.tasks = []
     self.bot.loop.create_task(self.init_reminders())