Ejemplo n.º 1
0
 def __init__(self, bot):
     self.bot = bot
     self.config = default.get("config.json")
     #폴더생성
     if os.path.isdir("./lib/shindan"):
         print("shindan folder exist")
     else:
         os.makedirs("./lib/shindan")
Ejemplo n.º 2
0
 def __init__(self, bot):
     self.bot = bot
     self.config = default.get("config.json")
     self.process = psutil.Process(os.getpid())
     # 폴더생성
     if os.path.isdir("./lib/covid/users"):
         print("covid folder exist")
     else:
         os.makedirs("./lib/covid/users")
Ejemplo n.º 3
0
 def __init__(self, bot):
     self.bot = bot
     self.config = default.get("config.json")
     # 폴더생성
     if os.path.isdir("./lib/shindan"):
         print("shindan folder exist")
     else:
         os.makedirs("./lib/shindan")
     if os.path.isfile("./lib/cache/shindan_request.ccf"):
         print("shindan cache file exist")
     else:
         f = open("./lib/cache/shindan_request.ccf", "w")
         f.close()
         f = open("./lib/cache/shindan_requestid.ccf", "w")
         f.close()
Ejemplo n.º 4
0
 def __init__(self, bot):
     self.bot = bot
     self.config = default.get("config.json")
     self.process = psutil.Process(os.getpid())
     #파일생성
     if os.path.isfile(cachelib + "usage.xlsx"):
         print("cache file exist")
     else:
         wb = openpyxl.Workbook()
         ws = wb.active
         ws.cell(row=1, column=1).value = "1"
         for i in range(1, 101):
             ws.cell(row=2, column=i).value = "0"
             ws.cell(row=3, column=i).value = "0"
         wb.save(cachelib + "usage.xlsx")
         wb.close()
Ejemplo n.º 5
0
 def __init__(self, bot):
     self.bot = bot
     self.config = default.get("config.json")
Ejemplo n.º 6
0
import discord
from discord.ext import commands
import wolframalpha
from evs import default
from evs.data import Bot, HelpFormat

config = default.get("config.json")


class Answer_ja(commands.Cog):
    def __init__(self, client):
        self.client = client

    # Commands
    @commands.command(name='正解')
    async def __answer(self, ctx, *, content: str):
        await ctx.trigger_typing()
        app_id = config.wolframapi_token
        client = wolframalpha.Client(app_id)
        try:
            res = client.query(content)
        except:
            embed = discord.Embed(title="分かんねえぇよ...",
                                  description="正解が見つかりませんでした。",
                                  color=0xeff0f1)
            embed.set_thumbnail(
                url=
                "https://cdn.discordapp.com/attachments/751791353779716099/751791533958627368/DARK_KETER.png"
            )
            await ctx.send(embed=embed)
            return
Ejemplo n.º 7
0
 def __init__(self, bot):
     self.bot = bot
     self.config = default.get("config.json")
     self.process = psutil.Process(os.getpid())
Ejemplo n.º 8
0
import discord

from evs import default
from discord.ext import commands

owners = default.get("config.json").owners


def is_owner(ctx):
    return ctx.author.id in owners


async def check_permissions(ctx, perms, *, check=all):
    if ctx.author.id in owners:
        return True

    resolved = ctx.channel.permissions_for(ctx.author)
    return check(
        getattr(resolved, name, None) == value
        for name, value in perms.items())


def has_permissions(*, check=all, **perms):
    async def pred(ctx):
        return await check_permissions(ctx, perms, check=check)

    return commands.check(pred)


async def check_priv(ctx, member):
    try: