Esempio n. 1
0
    def __init__(self, bot: discord.Client):
        self.bot = bot

        self.color = int(parser.get("Color", "default"), 16)
        self.error_color = int(parser.get("Color", "error"), 16)
        self.warning_color = int(parser.get("Color", "warning"), 16)

        self.players = {}
        self.youtube = Youtube(token=google_token, loop=bot.loop)
Esempio n. 2
0
    def __init__(
            self,
            context: Union[ApplicationContext, MessageCommand],
            client: discord.Client
    ):
        self.context = context
        self.channel = context.channel
        self.client = client

        self.color = int(parser.get("Color", "default"), 16)
        self.error_color = int(parser.get("Color", "error"), 16)
        self.warning_color = int(parser.get("Color", "warning"), 16)

        self.selection_id = "Search_Playlists"
Esempio n. 3
0
    def __init__(self, bot: discord.Client):
        self.bot = bot

        self.default_prefixes = list(
            json.loads(parser.get("DEFAULT", "default_prefixes")))

        self.prefix_caches = {}
Esempio n. 4
0
def get_database(database=None):
    for tries in ['MySQL1', 'MySQL2']:
        host = parser.get(tries, 'host')
        user = parser.get(tries, 'user')
        password = parser.get(tries, 'pass')
        if database is None:
            database = parser.get(tries, 'database')
        encoding = parser.get(tries, 'encoding')

        try:
            log.debug(f"{tries} section을 통하여 로그인을 시도합니다.")
            connection = pymysql.connect(host=host,
                                         user=user,
                                         password=password,
                                         db=database,
                                         charset=encoding)
        except pymysql.err.OperationalError:
            continue
        return connection
Esempio n. 5
0
async def inspection(ctx):
    embed = discord.Embed(
        title="\U000026A0 안내",
        description="죄송합니다. 지금은 PUBG BOT 점검 중입니다. 잠시 후 다시 시도해주세요. :(",
        color=warning_color)

    if parser.get("Inspection", "reason") != "" and parser.get(
            "Inspection", "reason") is not None:
        embed.description += "\n{}".format(parser.get("Inspection", "reason"))

    if parser.get("Inspection", "date") != "" and parser.get(
            "Inspection", "date") is not None:
        embed.description += "\n\n기간: {}".format(
            parser.get("Inspection", "date"))
    await ctx.send(embed=embed)
    return
Esempio n. 6
0
(at your option) any later version.

PUBG BOT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PUBG BOT.  If not, see <https://www.gnu.org/licenses/>.
"""

import discord
from config.config import parser
from module.interaction import ComponentsContext

color = int(parser.get("Color", "default"), 16)
error_color = int(parser.get("Color", "error"), 16)
warning_color = int(parser.get("Color", "warning"), 16)


async def inspection(ctx):
    embed = discord.Embed(
        title="\U000026A0 안내",
        description="죄송합니다. 지금은 PUBG BOT 점검 중입니다. 잠시 후 다시 시도해주세요. :(",
        color=warning_color)

    if parser.get("Inspection", "reason") != "" and parser.get(
            "Inspection", "reason") is not None:
        embed.description += "\n{}".format(parser.get("Inspection", "reason"))

    if parser.get("Inspection", "date") != "" and parser.get(
Esempio n. 7
0
 def __init__(self, bot):
     self.client = bot
     self.color = int(parser.get("Color", "default"), 16)
     self.error_color = int(parser.get("Color", "error"), 16)
     self.warning_color = int(parser.get("Color", "warning"), 16)
Esempio n. 8
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PUBG BOT.  If not, see <http://www.gnu.org/licenses/>.
"""

import pymysql.cursors

from config.config import parser
from utils.database import get_database

connect = get_database()

cur = connect.cursor(pymysql.cursors.DictCursor)
try:
    cur.execute("SELECT * from Music_Bot")
except pymysql.err.DatabaseError:
    client_list = {
        "token": parser.get("DEFAULT", "token"),
    }
else:
    client_list = cur.fetchone()

token = client_list.get('token')
google_token = []
for i in range(1, 12):
    google_token.append(client_list.get("google_client{i}".format(i=i)))

connect.close()
Esempio n. 9
0
def is_subowner(author):
    owners = parser.get("Permission", "SubOwner")
    for i in json.loads(owners):
        if author == i:
            return True
    return False
Esempio n. 10
0
def is_owner(user_id):
    owners = parser.get("Permission", "Owner")
    for i in json.loads(owners):
        if user_id == i:
            return True
    return False