Пример #1
0
 def __init__(self, *args, **options) -> None:
     super().__init__(shard_count=2, shard_ids=[0, 1], *args, **options)
     self.config = config
     self.uptime: float = time.time()
     self.log = log
     if config["guild_ids"]:
         log.warn(f"🛂 Commands will be registered in {config['guild_ids']}")
     else:
         log.warn("🌍 Commands will be registered GLOBALLY!")
     log.info("🔌 Loading extensions...")
     for file in os.listdir("atorin/commands"):
         if file.endswith(".py") and not file == "__init__.py":
             name: str = file[:-3]
             try:
                 self.load_extension(f"atorin.commands.{name}")
                 log.info(f"✅ Loaded extension: {name}")
             except discord.NoEntryPointError:
                 log.error(
                     f"❌ Extension {name} not loaded, because it doesn't have 'setup' function."
                 )
             except discord.ExtensionFailed as e:
                 log.error(
                     f"❌ Extension {e.name} failed to load. Error: {e.original}"
                 )
     log.info("✅ Extensions loaded successfully!")
     humanize.activate("pl_PL")
     self.statcord = statcord.Client(self, config["statcord"])
     self.statcord.start_loop()
Пример #2
0
    def __init__(self, bot):
        self.bot = bot

        self.statcord_client = statcord.Client(bot, bot.k.statcord, custom1=self.get_vote_count)
        self.statcord_client.start_loop()

        self.vote_count = 0
Пример #3
0
 def __init__(self, bot):
     self.bot = bot
     auth = ConfigParser()
     auth.read('../auth.ini')  # All my usernames and passwords for the api
     self.key = "statcord.com-" + auth.get('discord', 'STATCORDKEY')
     self.api = statcord.Client(self.bot, self.key)
     self.api.start_loop()
Пример #4
0
    def __init__(self, bot):
        self.bot = bot
        self.key = bot.config.STAT_TOKEN
        self.api = statcord.Client(self.bot, self.key, custom1=self.music)
        self.api.start_loop()

        self.help_icon = ''
        self.big_icon = ''
Пример #5
0
 def __init__(
     self,
     bot: commands.Bot
 ) -> None:
     self.bot = bot
     self.key = STATCORD_TOKEN
     self.api = statcord.Client(self.bot, self.key)
     self.api.start_loop()
Пример #6
0
 def __init__(self, bot, *args, **kwargs):
     super().__init__(bot, *args, **kwargs)
     self.statcord_api = statcord.Client(
         self.bot,
         self.config()['statcord_token'],
         custom1=self.statcord_custom_value_ducks_spawned,
         custom2=self.statcord_custom_value_players_count)
     self.statcord_api.start_loop()
     self.last_stats_post = 0
Пример #7
0
    def __init__(self, bot):
        self.bot = bot
        self.token = top_gg_auth
        self.dblpy = dbl.DBLClient(self.bot, self.token)
        self.key = f"statcord.com-{statcord_auth}"
        self.api = statcord.Client(self.bot, self.key)
        self.api.start_loop()

        @tasks.loop(hours=1, reconnect=True)
        async def post_updates():
            """Post updates to botlists"""

            await self.bot.wait_until_ready()

            try:
                await post_bot_stats(self.bot)
                await self.dblpy.post_guild_count()
            except Exception as e:
                print(e)
            else:
                print("Server count posted successfully")

        # Start the background task(s)
        post_updates.start()
Пример #8
0
 def __init__(self, bot):
     self.bot = bot
     self.key = STATCORD_TOKEN
     self.api = statcord.Client(self.bot, self.key)
     self.api.start_loop()
Пример #9
0
 def __init__(self, bot):
     self.bot = bot
     self.key = "statkey"
     self.api = statcord.Client(self.bot, self.key)
     self.api.start_loop()
Пример #10
0
    def __init__(self, bot):
        self.bot = bot

        self.api = statcord.Client(self.bot, os.environ.get("stat"))
        self.api.start_loop()
Пример #11
0
 def __init__(self, bot):
     self.bot = bot
     self.key = config.statcordkey
     print(f'{config.statcordkey}')
     self.api = statcord.Client(self.bot, self.key)
     self.api.start_loop()
Пример #12
0
 def __init__(self, bot):
     self.bot = bot
     self.key = "statcord.com-hNd0JKpZMOmqdXKy5ARs"
     self.api = statcord.Client(self.bot, self.key)
     self.api.start_loop()
Пример #13
0
 def __init__(self, bot):
     self.bot = bot
     self.key = os.environ.get('STATCORD_TOKEN')
     self.api = statcord.Client(self.bot, self.key)
     self.api.start_loop()
Пример #14
0
    asyncio.ensure_future(init_db_connection(config['database']))

basic_intents = discord.Intents.none()
basic_intents.guilds = True
basic_intents.webhooks = True
basic_intents.messages = True
basic_intents.reactions = True
bot = MyBot(
    description=config["bot"]["description"],
    intents=basic_intents,
    member_cache_flags=discord.MemberCacheFlags.from_intents(basic_intents))

bot.help_command = BoatHelp()
bot.blackfire = blackfire

stcd = statcord.Client(bot, config["auth"]["statcord"]["token"])
stcd.start_loop()
bot.statcord = stcd  # best way i know of to make a global system

for cog_name in config["cogs"]["cog_reloader"]["cogs_to_load"]:
    try:
        bot.load_extension(cog_name)
        bot.logger.debug(f"{cog_name} loaded!")
    except Exception as e:
        bot.logger.exception(
            f'Failed to load extension {cog_name}\n{type(e).__name__}: {e}')

try:
    bot.run(config['auth']['discord']['token'])
finally:
    if blackfire:
Пример #15
0
 def __init__(self, bot):
     self.bot = bot
     self.key = STATCORD_ID
     self.api = statcord.Client(self.bot,self.key,custom1=self.custom1,custom2=self.custom2)
     self.api.start_loop()
Пример #16
0
 def __init__(self, bot):
     self.bot = bot
     self.key = os.getenv("STATCORD")
     self.api = statcord.Client(self.bot, self.key)
     self.api.start_loop()
Пример #17
0
 def __init__(self, client):
     self.client = client
     self.key = os.environ.get("STATCORD_API_KEY")
     self.api = statcord.Client(self.client, self.key)
     self.api.start_loop()
Пример #18
0
 def __init__(self, bot):
     self.bot = bot
     self.repo_message.start()
     self.statkey = tokens.statcord
     self.statapi = statcord.Client(self.bot, self.statkey)
     self.statapi.start_loop()
Пример #19
0
    def __init__(self, bot):
        self.bot = bot
        self.d = self.bot.d

        self.statcord_client = statcord.Client(bot, self.d.statcord_key)
        self.statcord_client.start_loop()
Пример #20
0
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
"""
# DIABLO: Database Influenced Automated Ban List of Offenders

import discord
import os
from discord.ext import commands
import statcord

intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix = 'd.', intents=intents)

#STATCORD SO I CAN SEE STATS
key = "KEY"
api = statcord.Client(client,key)
api.start_loop()

# CommandNotFound
@client.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        embed = discord.Embed(title=":octagonal_sign: This command does not exist", description="Use `d.help` to get a full list of commands", color=0xCD1F1F)
        await ctx.send(embed=embed)

# Missing Permissions Error
@client.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.MissingPermissions):
        embed = discord.Embed(description=":octagonal_sign: You do not have the right permissions to run this command.", color=0xCD1F1F)
        await ctx.send(embed=embed)
Пример #21
0
        client.load_extension(extension)

bot.remove_command('help')


@bot.event
async def on_ready():
    print(f'Logged in as {bot.user.name} - {bot.user.id}')


#	bot.remove_command('help')

import statcord

key = 'statcord.com-c9AeEy6Wic9clB5nIxH0'
api = statcord.Client(bot, key)
api.start_loop()


@bot.event
async def on_command(ctx, *args):
    y = bot.get_channel(713061501333798932)
    lo = bot.get_channel(736792598458531892)
    await lo.send(
        f"**```{ctx.author} | {ctx.author.id} |\nUse {ctx.command.name} Commands\n-----------------------------------------------```**"
    )
    api.command_run(ctx)


@todoroki.command(helpinfo='Looks up a sequence of numbers',
                  aliases=['numbers', 'integers'])
Пример #22
0
 def __init__(self, bot):
     self.bot = bot
     self.key = f"statcord.com-{statcord_auth}"
     self.api = statcord.Client(self.bot, self.key)
     self.api.start_loop()