示例#1
0
 def __init__(self, bot):
     self.bot = bot
     self.udb = func_database.UserDatabase()
     self.sdb = func_database.ServerDatabase()
     self.idb = func_database.ItemDatabase()
     self.msg = func_msg_gen.MessageGenerator()
     self.helper = func_setting_helpers.SettingHelper(bot)
示例#2
0
 def __init__(self, bot):
     self.bot = bot
     self.msg = func_msg_gen.MessageGenerator()
     self.bj_reactions = {
         "🇭": "hit",
         "🇸": "stand",
         "🇩": "double down"
     }
     bj_embed = discord.Embed(title="Blackjack:",
                              description=func_economy.bj_string_generator(
                                  self.bj_reactions))
     bj_embed.set_footer(text="Play by pressing with the reactions below:")
     self.bj_embed = bj_embed
     self.udb = func_database.UserDatabase()
     self.cur = bot_settings.currency_name  # TODO: change to use server setting
示例#3
0
import discord
from discord.ext import commands

from functions import func_database

import bot_settings

udb = func_database.UserDatabase()
sdb = func_database.ServerDatabase()


class FullContext(commands.Context):
    def __init__(self, **attrs):
        super().__init__(**attrs)
        self.server_information = None
        self.global_information = None
        self.local_information = None

    async def get_user_information(self) -> tuple:
        """
        :return: tuple
            Global, Local
        """
        if not self.global_information or not self.local_information:
            global_information = await udb.get_user_information_global(self.author.id).to_list(length=1)
            self.global_information = global_information[0] if global_information else {}
            local_information = await udb.get_user_information(self.author.id, self.guild.id).to_list(length=1)
            self.local_information = local_information[0] if local_information else {}

        return self.global_information, self.local_information
示例#4
0
import ast
import random

import discord
from discord.ext import commands
import os
import traceback
import asyncio

import bot_settings
from functions import func_msg_gen, func_database, func_context, func_prefix, func_logs

MSG_GENERATOR = func_msg_gen.MessageGenerator()

UserDB = func_database.UserDatabase()
ServerDB = func_database.ServerDatabase()
Prefix = func_prefix.Prefix()
Logger = func_logs.Log()


class FullBot(commands.Bot):
    def __init__(self, command_prefix, **options):
        super().__init__(command_prefix, **options)
        self.logger = Logger.logging

    async def get_context(self, message, *, cls=func_context.FullContext):
        return await super().get_context(message, cls=cls)


async def get_prefix(bot, message):
    # gets the bot prefix
示例#5
0
 def __init__(self, bot):
     self.bot = bot
     self.msg_generator = func_msg_gen.MessageGenerator()
     self.cache = None
     self.sdb = func_database.ServerDatabase()
     self.udb = func_database.UserDatabase()
示例#6
0
 def __init__(self, bot):
     self.bot = bot
     self.udb = func_database.UserDatabase()
     self.msg = func_msg_gen.MessageGenerator()
     self.prefix = func_prefix.Prefix()
示例#7
0
 def __init__(self):
     global CACHE
     self.udb = func_database.UserDatabase()
     self.sdb = func_database.ServerDatabase()
     self.cache = CACHE