예제 #1
0
async def tuto(ctx, amount=1):
    USER_NAME = str(ctx.message.author)
    author = ctx.author
    message = ctx.message
    await ctx.send(f'Ah ! Bonjour jeune aventurier, tu doit être {USER_NAME} si je ne me trompe ? On m\'a beaucoup parlé de toi et de tes exploits. Si tu es ici c\'est pour une tache très simple :')
    await asyncio.sleep(10)
    await ctx.channel.purge(limit=amount)
    await ctx.send('SAUVER LE MONDE !')
    await asyncio.sleep(4)
    await ctx.channel.purge(limit=amount)
    await ctx.send('Alors prépare toi a une grande aventure !')
    await asyncio.sleep(4)
    await ctx.channel.purge(limit=amount)

    if not os.path.exists("players/{}".format(author.id)):
        os.makedirs("players/{}".format(author.id))
        new_account = {
            "name":f"{USER_NAME}",
            "Ready":"",
            "Mana": 5.0,
            "MaxMana":10.0,
            "LV":1.0,
            "XP":0.0,
            "Force":1.0,
            "Defence":1.0,
            "PV":100.0,
            "MaxPV":100.0,
            "Daily_time":0.0,
            "Language":1.0,
            "in_party": []
        }
        fileIO("players/{}/info.json".format(author.id), "save", new_account)
    info = fileIO("players/{}/info.json".format(author.id), "load")

    await ctx.send('Faite la commande "!ready" quand vous êtes prêt.')
예제 #2
0
async def _check_levelup(ctx):
    author = ctx.author
    info_location = fileIO("players/{}/info.json".format(author.id), "load")
    xp = info_location["XP"]
    num = 1000.0
    name = info_location["name"]
    lvl = info_location["LV"]
    lvlexp = num * lvl
    GMaxMana = randint(0,1)
    GForce = randint(0,1)
    GDefence = randint(0,1)
    GPVMax = randint(0,2)


    if xp >= lvlexp:
        await ctx.send("```diff\n+ {} a gagné un level ! + {} MaxMana, + {} MaxPV, + {} Force, + {} Defence. ```".format(name, GMaxMana, GPVMax, GForce, GDefence))
        info_location["LV"] = info_location["LV"] + 1.0
        info_location["MaxMana"] = info_location["MaxMana"] + GMaxMana
        info_location["Force"] = info_location["Force"] + GForce
        info_location["Defence"] = info_location["Defence"] + GDefence
        info_location["MaxPV"] = info_location["MaxPV"] + GPVMax

        fileIO("players/{}/info.json".format(author.id), "save", info_location)
        return await _check_levelup(ctx)
    else:
        pass
예제 #3
0
async def daily(ctx):
    DailyC = randint(100, 1000)
    DailyX = randint(700, 1500)
    author = ctx.author
    info_location = fileIO("players/{}/info.json".format(author.id), "load")
    USER_ID = ctx.message.author.id
    USER_NAME = str(ctx.message.author)
    curr_time = time.time()
    delta = float(curr_time) - float(info_location["Daily_time"])

    if delta >= 86400.0 and delta>0:
        info_location["Daily_time"] = curr_time
        fileIO("players/{}/info.json".format(ctx.author.id), "save", info_location)
        await ctx.send(f"{ctx.message.author.mention} tu gagne {DailyC} coin et {DailyX} XP.")

        SQL.execute(f'select Coin from Accounts where user_id="{USER_ID}"')

        SQL.execute(f'update Accounts set Coin = Coin + {DailyC} where user_id="{USER_ID}"')
        db.commit()
        result_userbal = SQL.fetchone()

        info_location["XP"] = info_location["XP"] + DailyX
        fileIO("players/{}/info.json".format(author.id), "save", info_location)
    else:
        seconds = 86400 - delta
        m, s = divmod(seconds, 60)
        h, m = divmod(m, 60)
        await ctx.send("```diff\n-â–º Tu peux recuperer ton daily dans :{} Heures, {} Minutes, et {} Secondes```".format(int(h), int(m), int(s)))

    await _check_levelup(ctx)
예제 #4
0
async def registerAccount(user, message):
	if user.id not in bank:
		bank[user.id] = {"name" : user.name, "balance" : 100}
		dataIO.fileIO("json/economy.json", "save", bank)
		await client.send_message(message.channel, "{} `Account opened. Current balance: {}`".format(user.mention, str(checkBalance(user.id))))
	else:
		await client.send_message(message.channel, "{} `You already have an account at the Twentysix bank.`".format(user.mention))
예제 #5
0
async def ready(ctx):
    USER_NAME = str(ctx.message.author)
    author = ctx.author
    message = ctx.message

    info_location = fileIO("players/{}/info.json".format(member.id), "load")
    info_location["Ready"] = info_location["ready"] + 1
    fileIO("players/{}/info.json".format(ctx.author.id), "save", info_location)
예제 #6
0
def withdrawMoney(id, amount):
	if accountCheck(id):
		if bank[id]["balance"] >= int(amount):
			bank[id]["balance"] = bank[id]["balance"] - int(amount)
			dataIO.fileIO("json/economy.json", "save", bank)
		else:
			return False
	else:
		return False
예제 #7
0
def withdrawMoney(id, amount):
    if accountCheck(id):
        if bank[id]["balance"] >= int(amount):
            bank[id]["balance"] = bank[id]["balance"] - int(amount)
            dataIO.fileIO("json/economy.json", "save", bank)
        else:
            return False
    else:
        return False
예제 #8
0
 def file_checks(self, fs):
     if "server" not in fs:
         if "sdp" not in fs:
             print("Invalid file, recreating")
             fileIO("config/{}.json".format(self.filename), "w", self.s)
         else:
             print("Resolving server ip ...")
             self.get_SDP_ip()
             if "server" not in self.s:
                 self.set_server(self.server)
예제 #9
0
async def registerAccount(user, message):
    if user.id not in bank:
        bank[user.id] = {"name": user.name, "balance": 100}
        dataIO.fileIO("json/economy.json", "save", bank)
        await client.send_message(
            message.channel, "{} `Account opened. Current balance: {}`".format(
                user.mention, str(checkBalance(user.id))))
    else:
        await client.send_message(
            message.channel,
            "{} `You already have an account at the Twentysix bank.`".format(
                user.mention))
예제 #10
0
async def lang(ctx, arg):
    author = ctx.author

    info_location = fileIO("players/{}/info.json".format(author.id), "load")
    if arg == "fr":
        info_location["Language"] = info_location["Language"] == 1.0
        await author.create_dm()
        await author.dm_channel.send(f'B-Warfare est configuré en français.')
    elif arg == "en":
        info_location["Language"] = info_location["Language"] == 0.0
        await author.create_dm()
        await author.dm_channel.send(f'B-Warfare is translated into english.')


    fileIO("players/{}/info.json".format(author.id), "save", info_location)
예제 #11
0
def check_files():
    f = "data.json"
    if not fileIO(f, "check"):
        print("data.json does not exist. Creating empty data.json...")
        fileIO(
            f, "save", {
                "Twitter": {
                    "consumer_key": "",
                    "consumer_secret": "",
                    "access_token": "",
                    "access_token_secret": ""
                },
                "Discord": [],
                "twitter_ids": []
            })
예제 #12
0
async def Mana(ctx):
    info_location = fileIO("players/{}/info.json".format(author.id), "load")
    Mana = info_location["Mana"]
    MaxMana = info_location["MaxMana"]

        if Mana == MaxMana
            await ctx.send(f"Tu ne peux plus stocker de Mana.")
예제 #13
0
async def test_01(ctx):
    USER_NAME = str(ctx.message.author)
    author = ctx.author
    info_location = fileIO("players/{}/info.json".format(author.id), "load")

    if info_location["Language"] == 1.0:
        await ctx.send(f"Salut, je suis B-Warfare traduit en français.")
    elif info_location["Language"] == 0.0:
        await ctx.send(f"Hi, I'm B-Warfare translated into english.")
예제 #14
0
    def do_GET(self):
        # Send response status code
        self.send_response(200)

        parsed_path = urlparse(self.path)
        ret = {}

        self.send_header("Content-type", "image/png")

        params = dict([p.split('=') for p in parsed_path[4].split('&')])
        url = params['face_url']
        image_num = params['num']

        get_images(url, image_num) # gets the two eye images, microsoft api

        # right eye
        ret['right_per'] = percent_of_org('eyeRight_{}.png'.format(image_num), image_num)
        send_right_img = 'eye_contour.png'
        right_eye = open(send_right_img, encoding='latin-1')
        right_stat = os.stat(send_right_img)
        right_size = right_stat.st_size
        f = open(send_right_img, encoding='latin-1')
        ret['right_img'] = f.read()
        f.close()

        # left eye
        ret['left_per'] = percent_of_org('eyeLeft_{}.png'.format(image_num), image_num)
        send_left_img = 'eye_contour.png'
        left_eye = open(send_left_img, encoding='latin-1')
        left_stat = os.stat(send_left_img)
        left_size = left_stat.st_size
        f = open(send_left_img, encoding='latin-1')
        ret['left_img'] = f.read()
        f.close()

        # get graph
        graph_img = 'graph.png'
        graph = open(graph_img, encoding='latin-1')
        graph_stat = os.stat(graph_img)
        graph_size = left_stat.st_size
        f = open(graph_img, encoding='latin-1')
        ret['graph'] = f.read()
        f.close()

        # graph data
        ret["graph_data"] = fileIO("data.json", "load")

        #ret_file = "return.json"
        #if not fileIO(ret_file, "check"):
        #    fileIO(ret_file, "save", ret)
        #ret = fileIO(ret_file, "load")
        
        self.wfile.write(bytes(str(ret), 'latin-1'))
        
        return
예제 #15
0
 def _init_check(self):
     if not os.path.exists("config"):
         os.makedirs("config")
         fileIO("config/{}.json".format(self.filename), "w", self.s)
     else:
         fs = fileIO("config/{}.json".format(self.filename), "r")
         # =====================
         self.file_checks(fs)
         # =====================
         self.s = fileIO("config/{}.json".format(self.filename), "r")
     if not fileIO("config/{}.json".format(self.filename), "c"):
         fileIO("config/{}.json".format(self.filename), "w", self.s)
예제 #16
0
async def shop(ctx):
    USER_ID = ctx.message.author.id
    USER_NAME = str(ctx.message.author)
    info_location = fileIO("players/{}/info.json".format(ctx.author.id), "load")
    if info_location["Ready"]  == 0:
        await ctx.send("Tu dois d\'abord faire le tuto avant de commencer ta grande aventure ! `{}tuto`".format(Prefix))
        return
    embed = discord.Embed(
        title=f"SHOP",
        color=0x36FF00
    )
    embed.add_field(name='Bienvenue dans le "SHOP" !',value='Ici tu peux vendre n\'importe quel objet')
    embed.add_field(name='!sell [insérer nom objet] [nombre]',value='Cette commande sert a vendre un objet unique.')
    embed.add_field(name='!sell all',value='Celle-ci sert a vendre tout les minerais de votre inventaire.')
    await ctx.channel.send(embed=embed)
예제 #17
0
def percent_of_org(current_file: str, num: int):
    is_Left = False
    if 'Left' in str(current_file):
        start_file = "eyeLeft_1.png"
        is_Left = True
    else:
        start_file = "eyeRight_1.png"

    start = find_pupil_diameter(start_file) / find_eye_length(start_file)
    current = find_pupil_diameter(current_file) / find_eye_length(current_file)

    per_of_org = (current / start) * 100

    # check file existence
    data_file = "data.json"
    if not fileIO(data_file, "check"):
        fileIO(data_file, "save", {})
    # write information to json
    data = fileIO(data_file, "load")

    num = int(re.search(r'\d+', current_file).group())

    if num == 1 and len(data[str(num)]) == 2:
        data = {}

    if str(num) not in data:
        data[str(num)] = {}

    if len(data[str(num)]) == 2:
        data[str(num)] = {}

    if is_Left:
        data[str(num)]['left'] = per_of_org
    else:
        data[str(num)]['right'] = per_of_org

    fileIO('data.json', "save", data)

    print("GEN GRAPH")
    if len(data[str(num)]) % 2 == 0:
        print("ACTUALLY GEN GRAPH")
        generate_graph()
    return per_of_org
예제 #18
0
def addMoney(id, amount):
    if accountCheck(id):
        bank[id]["balance"] = bank[id]["balance"] + int(amount)
        dataIO.fileIO("json/economy.json", "save", bank)
    else:
        return False
예제 #19
0
def initialize(c):
    global client, bank
    bank = dataIO.fileIO("json/economy.json", "load")
    client = c
        print ('Something went wrong while writing.')  

if __name__ == '__main__':
    #Appdata/Roaming
    global ROAMING
    setpoints = {}
    APP_DIRNAME = 'SwitchMouseSensitivity'
    if not os.path.exists(os.path.join(os.environ['APPDATA'],APP_DIRNAME)):
        try:
            os.mkdir(os.path.join(os.environ['APPDATA'],APP_DIRNAME))
            ROAMING = os.path.join(os.environ['APPDATA'],APP_DIRNAME)
        except:
            print('Error creating settings folder')       
    ROAMING = os.environ['APPDATA']+'\\'+APP_DIRNAME+'\\' 
    dataIO.loadAndCheckSettings(ROAMING, True)
    setpoints = dataIO.fileIO(ROAMING+sp_json, "load")
    
    #Get current sensitivity and save to json
    setpoints["curReg"] = setpoints["curReg"] = get_spi('SPI_GETMOUSESPEED')
    dataIO.fileIO(ROAMING+sp_json, "save", setpoints)
    print ('Current mouse sensitivity : '+str(setpoints["curReg"]))
    
    #Check for run parameter
    if len(sys.argv) > 1: #arguments is given
        sens = sys.argv[1]
        if checkValue(sens) == True:
            print ('Changing the sensitivity by run parameter to: '+sens)
            writeSense(sens)
            os.system('pause')
            exit(1)
예제 #21
0
async def i(ctx, ):
    author = ctx.author
    USER_ID = ctx.message.author.id
    USER_NAME = str(ctx.message.author)
    info_location = fileIO("players/{}/info.json".format(ctx.author.id), "load")
    Mana = info_location["Mana"]
    MaxMana = info_location["MaxMana"]
    PV = info_location["PV"]
    MaxPV = info_location["MaxPV"]
    XP = info_location["XP"]
    LV = info_location["LV"]
    Defence = info_location["Defence"]
    Force = info_location["Force"]

    SQL.execute(
        'create table if not exists Accounts("Num" integer primary key autoincrement, "user_name" text, "user_id" integer NOT NULL, "Pierre" REAL, "Charbon" REAL, "Fer" REAL, "Cuivre" REAL, "Cobalt" REAL, "Gold" REAL,"Platine" REAL, "Diamant" REAL, "Palladium" REAL, "Obsidienne" REAL, "Coin" REAL)')
    SQL.execute(f'select user_id from Accounts where user_id="{USER_ID}"')
    result_userID = SQL.fetchone()

    if result_userID is None:
        SQL.execute(
            'insert into Accounts(user_name, user_id, Pierre, Charbon, Fer, Cuivre, Cobalt, Gold, Platine, Diamant, Palladium, Obsidienne, Coin) values(?,?,?,?,?,?,?,?,?)',
            (USER_NAME, USER_ID, START_BALANCE, s0, s0, s0, s0, s0, s0, s0, s0, s0, s0))
        db.commit()

    embed = discord.Embed(
        title=f"inventaire de {USER_NAME}",
        color=0xFFD801
    )

    SQL.execute(f'select Pierre from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Pierre", value=f"{result_userbal[0]} {Pierre}", inline=True)

    SQL.execute(f'select Charbon from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Charbon", value=f"{result_userbal[0]} {Charbon}", inline=True)

    SQL.execute(f'select Fer from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Fer", value=f"{result_userbal[0]} {Fer}", inline=True)

    SQL.execute(f'select Cuivre from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Cuivre", value=f"{result_userbal[0]} {Cuivre}", inline=True)

    SQL.execute(f'select Cobalt from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Cobalt", value=f"{result_userbal[0]} {Cobalt}", inline=True)

    SQL.execute(f'select Gold from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Or", value=f"{result_userbal[0]} {Gold}", inline=True)

    SQL.execute(f'select Platine from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Platine", value=f"{result_userbal[0]} {Platine}", inline=True)

    SQL.execute(f'select Diamant from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Diamant", value=f"{result_userbal[0]} {Diamant}", inline=True)

    SQL.execute(f'select Palladium from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Palladium", value=f"{result_userbal[0]} {Palladium}", inline=True)

    SQL.execute(f'select Obsidienne from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Obsidienne", value=f"{result_userbal[0]} {Obsidienne}", inline=True)

    SQL.execute(f'select Coin from Accounts where user_id="{USER_ID}"')
    result_userbal = SQL.fetchone()

    embed.add_field(name="Coin", value=f"{result_userbal[0]} {Coin}", inline=True)

    embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/721338399562137610/732740123392999454/Sac.png")

    embed.set_footer(text=time.strftime('%A %d/%m/%Y %H:%M:%S'))

    await ctx.channel.send(embed=embed)

    embed = discord.Embed(
        title=f"Consommable de {USER_NAME}",
        color=0xFFD801
    )

    embed.add_field(name="Mana", value=f"{Mana} / {MaxMana} :alembic:", inline=True)
    embed.add_field(name="PV", value=f"{PV} / {MaxPV} :heart:", inline=True)
    embed.add_field(name="LV/XP", value=f"{LV} ( {XP} )", inline=True)
    embed.add_field(name="Force", value=f"{Force} :crossed_swords:", inline=True)
    embed.add_field(name="Defence", value=f"{Defence} :shield:", inline=True)

    await ctx.channel.send(embed=embed)
예제 #22
0
def initialize():
	global bank
	bank = dataIO.fileIO("json/economy.json", "load")
예제 #23
0
from dataIO import fileIO
import os

false_strings = ["false", "False", "f", "F", "0", ""]

if fileIO("config.json", "check"):
    config = fileIO("config.json", "load")
else:
    config = {
        "client_id":
        os.environ["CLIENT_ID"],
        "client_secret":
        os.environ["CLIENT_SECRET"],
        "username":
        os.environ["USERNAME"],
        "password":
        os.environ["PASSWORD"],
        "user_agent":
        os.environ["USER_AGENT"],
        "subreddit":
        os.environ["SUBREDDITS"].replace(" ", "").split(","),
        "users":
        os.environ["USERS"].lower().replace(" ", "").split(","),
        "bot_is_moderator":
        False if os.environ["BOT_IS_MODERATOR"] in false_strings else True,
        "store_size":
        int(os.environ["STORE_SIZE"]),
        "intro":
        os.environ["INTRO"]
    }
예제 #24
0
 def write_config(self):
     self.pre_write()
     fileIO("config/{}.json".format(self.filename), "w", self.s)
예제 #25
0
def initialize():
    global bank
    bank = dataIO.fileIO("json/economy.json", "load")
예제 #26
0
from tweepy import OAuthHandler, Stream
from main import StdOutListener
import os
from dataIO import fileIO

if __name__ == '__main__':
    if not fileIO("data.json", "check"):
        print("data.json does not exist. Creating empty data.json...")
        fileIO(
            "data.json", "save", {
                "Twitter": {
                    "consumer_key": os.environ["CONSUMER_KEY"],
                    "consumer_secret": os.environ["CONSUMER_SECRET"],
                    "access_token": os.environ["ACCESS_TOKEN"],
                    "access_token_secret": os.environ["ACCESS_TOKEN_SECRET"]
                },
                "Discord": [{
                    "IncludeReplyToUser":
                    True,
                    "IncludeRetweet":
                    True,
                    "IncludeUserReply":
                    True,
                    "webhook_urls":
                    os.environ["WEBHOOK_URL"].replace(" ", "").split(","),
                    "twitter_ids":
                    os.environ["TWITTER_ID"].replace(" ", "").split(",")
                }]
            })

    data_t = fileIO("data.json", "load")
예제 #27
0
async def mine(ctx):
    MPierre = randint(10000, 50000)
    MCharbon = randint(7500, 35000)
    MFer = randint(4500, 20000)
    MCuivre = randint(2500, 10000)
    MCobalt = randint(1000, 5000)
    MOr = randint(500, 2500)
    MPlatine = randint(1000, 5000)
    MDiamant = randint(0, 20)
    MPalladium = randint(1000, 5000)
    MObsidienne = randint(2500, 10000)
    MXP = randint(10, 150)
    USER_ID = ctx.message.author.id
    USER_NAME = str(ctx.message.author)
    info_location = fileIO("players/{}/info.json".format(ctx.author.id), "load")

    if info_location["Mana"] < 1.0 :
        await ctx.send("```diff\n-► Vous n'avez pas assez de Mana pour réaliser cette action.```")
    else :

        info_location["Mana"] = info_location["Mana"] - 1.0

        info_location["XP"] = info_location["XP"] + MXP

        embed = discord.Embed(
        title=f"Vous avez minez :",
        color=0x00FFFB
        )

        SQL.execute(f'select Pierre from Accounts where user_id="{USER_ID}"')

        SQL.execute(f'update Accounts set Pierre = Pierre + {MPierre} where user_id="{USER_ID}"')
        db.commit()
        result_Pierre = SQL.fetchone()

        embed.add_field(name="Pierre", value=f"{MPierre}", inline=True)

        SQL.execute(f'select Charbon from Accounts where user_id="{USER_ID}"')

        SQL.execute(f'update Accounts set Charbon = Charbon + {MCharbon} where user_id="{USER_ID}"')
        db.commit()
        result_Charbon = SQL.fetchone()

        embed.add_field(name="Charbon", value=f"{MCharbon}", inline=True)

        SQL.execute(f'select Fer from Accounts where user_id="{USER_ID}"')

        SQL.execute(f'update Accounts set Fer = Fer + {MFer} where user_id="{USER_ID}"')
        db.commit()
        result_Fer = SQL.fetchone()

        embed.add_field(name="Fer", value=f"{MFer}", inline=True)

        SQL.execute(f'select Cuivre from Accounts where user_id="{USER_ID}"')

        SQL.execute(f'update Accounts set Cuivre = Cuivre + {MCuivre} where user_id="{USER_ID}"')
        db.commit()
        result_Cuivre = SQL.fetchone()

        embed.add_field(name="Cuivre", value=f"{MCuivre}", inline=True)

        SQL.execute(f'select Obsidienne from Accounts where user_id="{USER_ID}"')
        SQL.execute(f'update Accounts set Obsidienne = Obsidienne + {MObsidienne} where user_id="{USER_ID}"')
        db.commit()
        result_Obsidienne = SQL.fetchone()

        embed.add_field(name="Obsidienne", value=f"{MObsidienne}", inline=True)

        SQL.execute(f'select Cobalt from Accounts where user_id="{USER_ID}"')
        SQL.execute(f'update Accounts set Cobalt = Cobalt + {MCobalt} where user_id="{USER_ID}"')
        db.commit()
        result_Cobalt = SQL.fetchone()

        embed.add_field(name="Cobalt", value=f"{MCobalt}", inline=True)

        SQL.execute(f'select Platine from Accounts where user_id="{USER_ID}"')
        SQL.execute(f'update Accounts set Platine = Platine + {MPlatine} where user_id="{USER_ID}"')
        db.commit()
        result_Platine = SQL.fetchone()

        embed.add_field(name="Platine", value=f"{MPlatine}", inline=True)

        SQL.execute(f'select Palladium from Accounts where user_id="{USER_ID}"')
        SQL.execute(f'update Accounts set Palladium = Palladium + {MPalladium} where user_id="{USER_ID}"')
        db.commit()
        result_Palladium = SQL.fetchone()

        embed.add_field(name="Palladium", value=f"{MPalladium}", inline=True)

        SQL.execute(f'select Gold from Accounts where user_id="{USER_ID}"')
        SQL.execute(f'update Accounts set Gold = Gold + {MOr} where user_id="{USER_ID}"')
        db.commit()
        result_Or = SQL.fetchone()

        embed.add_field(name="Or", value=f"{MOr}", inline=True)

        SQL.execute(f'select Diamant from Accounts where user_id="{USER_ID}"')
        SQL.execute(f'update Accounts set Diamant = Diamant + {MDiamant} where user_id="{USER_ID}"')
        db.commit()
        result_Diamant = SQL.fetchone()

        embed.add_field(name="Diamant", value=f"{MDiamant}", inline=True)


        embed.add_field(name="XP", value=f"{MXP}", inline=True)

        embed.set_thumbnail(
            url="https://media.discordapp.net/attachments/721338399562137610/732734690565292113/8096.png")

        fileIO("players/{}/info.json".format(ctx.author.id), "save", info_location)

        await ctx.channel.send(embed=embed)

        await _check_levelup(ctx)
예제 #28
0
from dataIO import fileIO
import os

false_strings = ["false", "False", "f", "F", "0", ""]

if fileIO("data.json", "check"):
    data_json = fileIO("data.json", "load")
else:
    data_json = {
        "Twitter": {
            "consumer_key": os.environ["CONSUMER_KEY"],
            "consumer_secret": os.environ["CONSUMER_SECRET"],
            "access_token": os.environ["ACCESS_TOKEN"],
            "access_token_secret": os.environ["ACCESS_TOKEN_SECRET"]
        },
        "Discord": [
            {
                "IncludeReplyToUser": True,
                "IncludeRetweet": True,
                "IncludeUserReply": True,
                "webhook_urls": os.environ.get("WEBHOOK_URL", []).replace(" ", "").split(","),
                "twitter_ids": os.environ.get("TWITTER_ID", []).replace(" ", "").split(",")
            }
        ],
        "twitter_ids": []
    }
예제 #29
0
from random import randint, choice
import time

import dataIO

bank = dataIO.fileIO("economy.json", "load")
client = None
#words = dataIO.loadWords()
#anagram_sessions_timestamps = {}
anagram_sessions = []
payday_register = {}
PAYDAY_TIME = 300 # seconds between each payday
PAYDAY_CREDITS = 120 # credits received

slot_help = """ Slot machine payouts:
:two: :two: :six: Bet * 5000
:four_leaf_clover: :four_leaf_clover: :four_leaf_clover: +1000
:cherries: :cherries: :cherries: +800
:two: :six: Bet * 4
:cherries: :cherries: Bet * 3

Three symbols: +500
Two symbols: Bet * 2

You need an account to play. !register one.
Bet range: 5 - 100
"""

economy_exp = """ **Economy. Get rich and have fun with imaginary currency!**

!register - Register an account at the Twentysix bank
예제 #30
0
def addMoney(id, amount):
	if accountCheck(id):
		bank[id]["balance"] = bank[id]["balance"] + int(amount)
		dataIO.fileIO("json/economy.json", "save", bank)
	else:
		return False
예제 #31
0
def initialize(c):
	global client, bank
	bank = dataIO.fileIO("json/economy.json", "load")
	client = c
예제 #32
0
    def send_head(self):
        """Common code for GET and HEAD commands.
        This sends the response code and MIME headers.
        Return value is either a file object (which has to be copied
        to the outputfile by the caller unless the command was HEAD,
        and must be closed by the caller under all circumstances), or
        None, in which case the caller has nothing further to do.
        """

        # Send response status code
        self.send_response(200)

        self.send_header("Access-Control-Allow-Origin", "*")
        self.send_header("Content-type", "image/png")

        image_num = re.sub("[^0-9]", "", str(self.path).rsplit('/', 1)[-1])

        url = 'http://minh.heliohost.org/detection_disease/uploads/face{}.png'.format(
            image_num)
        ret = {}

        get_images(url, image_num)  # gets the two eye images, microsoft api

        self.send_header("Access-Control-Allow-Origin", "*")
        self.send_header("Content-type", "image/png")

        # right eye
        ret['right_per'] = percent_of_org('eyeRight_{}.png'.format(image_num),
                                          image_num)
        send_right_img = 'eye_contour.png'
        right_eye = open(send_right_img, encoding='latin-1')
        right_stat = os.stat(send_right_img)
        right_size = right_stat.st_size
        f = open(send_right_img, encoding='latin-1')
        # ret['right_img'] = f.read()
        f.close()

        self.send_header("Access-Control-Allow-Origin", "*")
        self.send_header("Content-type", "image/png")

        # left eye
        ret['left_per'] = percent_of_org('eyeLeft_{}.png'.format(image_num),
                                         image_num)
        send_left_img = 'eye_contour.png'
        left_eye = open(send_left_img, encoding='latin-1')
        left_stat = os.stat(send_left_img)
        left_size = left_stat.st_size
        f = open(send_left_img, encoding='latin-1')
        # ret['left_img'] = f.read()
        f.close()

        self.send_header("Access-Control-Allow-Origin", "*")
        self.send_header("Content-type", "image/png")

        # get graph
        graph_img = 'graph.png'
        graph = open(graph_img, encoding='latin-1')
        graph_stat = os.stat(graph_img)
        graph_size = left_stat.st_size
        f = open(graph_img, encoding='latin-1')
        # ret['graph'] = f.read()
        f.close()

        # graph data
        ret["graph_data"] = fileIO("data.json", "load")

        #ret_file = "return.json"
        #if not fileIO(ret_file, "check"):
        #    fileIO(ret_file, "save", ret)
        #ret = fileIO(ret_file, "load")

        self.wfile.write(bytes(str(ret), 'latin-1'))

        return
예제 #33
0
import sqlite3
import json
import hashlib
import locale
from dataIO import fileIO
from getpass import getpass
try:
    from discord.ext import commands, tasks
    import discord
except ImportError:
    print("Discord.py is not installed. Please install it!")
    sys.exit(30)

locale.setlocale(locale.LC_TIME, 'FR')

config_location = fileIO("assets/config/config.json", "load")
Shards = config_location["Shards"]
Prefix = config_location["Prefix"]
PASSWORD = config_location["PASSWORD"]

client = commands.AutoShardedBot(shard_count=Shards, command_prefix=Prefix)

#-----------------------PASSWORD-------------------------#
chaine_mot_de_passe = b'Pdzas8R6T7987xErP'
mot_de_passe_chiffre = hashlib.sha1(chaine_mot_de_passe).hexdigest()

verrouille = True
while verrouille:
    entre = getpass("Tapez le mot de passe : ")
    # encodage de la saisie pour avoir un type bytes
    entre = entre.encode()
예제 #34
0
 def __init__(self):
     self.data = fileIO("data.json", "load")
예제 #35
0
async def on_command(command):
    info = fileIO("assets/config/config.json", "load")
    info["Commands_used"] = info["Commands_used"] + 1
    fileIO("assets/config/config.json", "save", info)
예제 #36
0
 def saveConfig(self):
     fileIO("data.json", "save", self.data)
예제 #37
0
import json
import hashlib
import locale
from dataIO import fileIO
from getpass import getpass

try:
    from discord.ext import commands, tasks
    import discord
except ImportError:
    print("Discord.py is not installed. Please install it!")
    sys.exit(30)

locale.setlocale(locale.LC_TIME, 'FR')

config_location = fileIO("assets/config/config.json", "load")
Shards = config_location["Shards"]
Prefix = config_location["Prefix"]
PASSWORD = config_location["PASSWORD"]

#info_location = fileIO("players/{}/info.json".format(member.id), "load")
#Mana = info_location["Mana"]
#MaxMana = info_location["MaxMana"]
#PV = info_location["PV"]
#MaxPV = info_location["MaxPV"]
#Defence = info_location["Defence"]
#Force = info_location["Force"]
#LV = info_location["LV"]
#XP = info_location["XP"]