コード例 #1
0
 async def playertime(self, ctx, ip: str, *, name: str):
     conn = mysql.connector.connect(host=HOST,
                                    user=USER,
                                    passwd=PASSWD,
                                    database=DATABASE)
     c = conn.cursor()
     c.execute(
         f"SELECT ip FROM costumers WHERE guild_id = '{ctx.get_guild().id}' AND ipname = '{ip}'"
     )
     mgeli = c.fetchone()
     c.execute(
         f"SELECT lan FROM language WHERE guild_id = '{ctx.get_guild().id}'"
     )
     lang = c.fetchone()
     conn.commit()
     if mgeli is not None:
         core = scraper.GTcore(mgeli[0])
         graph_player_time = core.player_time(name)
         embed = hikari.Embed(title=name, color=COLOR)
         embed.set_image(f"https:{graph_player_time}")
         await ctx.respond(embed=embed)
     else:
         core = scraper.GTcore(ip)
         if core.checkip() == False:
             await ctx.respond(
                 get_lang("en", "player_response_error") if lang is None
                 else get_lang(lang[0], "player_response_error"))
         else:
             graph_player_time = core.player_time(name)
             embed = hikari.Embed(title=name, color=COLOR)
             embed.set_image(f"https:{graph_player_time}")
             await ctx.respond(embed=embed)
コード例 #2
0
    async def top10(self, ctx, *, ip: str):
        conn = mysql.connector.connect(host=HOST,
                                       user=USER,
                                       passwd=PASSWD,
                                       database=DATABASE)
        c = conn.cursor()

        c.execute(
            f"SELECT ip FROM costumers WHERE guild_id = '{ctx.get_guild().id}' AND ipname = '{ip}'"
        )
        result = c.fetchone()
        c.execute(
            f"SELECT lan FROM language WHERE guild_id = '{ctx.get_guild().id}'"
        )
        lang = c.fetchone()
        conn.commit()

        if result is not None:
            core = scraper.GTcore(result[0])
            top = core.top10(result[0])
            await ctx.respond(f"```{top}```")
        else:
            core = scraper.GTcore(ip)
            if core.checkip() == False:
                await ctx.respond(
                    get_lang("en", "ip_error") if lang is None else get_lang(
                        lang[0], "ip_error"))
            else:
                top = core.top10(ip)
                await ctx.respond(f"```{top}```")
コード例 #3
0
    async def currentmap(self, ctx, *, ip: str):
        conn = mysql.connector.connect(host=HOST,
                                       user=USER,
                                       passwd=PASSWD,
                                       database=DATABASE)
        c = conn.cursor()

        c.execute(
            f"SELECT ip FROM costumers WHERE guild_id = '{ctx.get_guild().id}' AND ipname = '{ip}'"
        )
        result = c.fetchone()
        c.execute(
            f"SELECT lan FROM language WHERE guild_id = '{ctx.get_guild().id}'"
        )
        lang = c.fetchone()
        conn.commit()
        if result is not None:
            core = scraper.GTcore(result[0])
            title = core.name()
            map = core.map()
            map_image = core.mapimage()
            scanned = core.scan()

            embed = hikari.Embed(title=title,
                                 description=f"`{map}`",
                                 color=COLOR)
            embed.set_image("https:" + map_image)
            embed.set_footer(text=scanned)
            message = await ctx.respond(embed=embed)
        else:
            core = scraper.GTcore(ip)
            if core.checkip() == False:
                await ctx.respond(
                    get_lang("en", "ip_error") if lang is None else get_lang(
                        lang[0], "ip_error"))
            else:
                title = core.name()
                map = core.map()
                map_image = core.mapimage()
                scanned = core.scan()

                embed = hikari.Embed(title=title,
                                     description=f"`{map}`",
                                     color=COLOR)
                embed.set_image("https:" + map_image)
                embed.set_footer(text=scanned)
                await ctx.respond(embed=embed)
コード例 #4
0
 async def top15(self, ctx, *, ip: str):
     conn = mysql.connector.connect(host=HOST,
                                    user=USER,
                                    passwd=PASSWD,
                                    database=DATABASE)
     c = conn.cursor()
     c.execute(
         f"SELECT ip FROM costumers WHERE guild_id = '{ctx.get_guild().id}' AND ipname = '{ip}'"
     )
     result = c.fetchone()
     conn.commit()
     if result is not None:
         server = scraper.GTcore(result[0])
         await ctx.respond(f"```{server.top15()}```")
     else:
         server = scraper.GTcore(ip)
         await ctx.respond(f"```{server.top15()}```")
コード例 #5
0
    async def info(self, ctx, *, ip: str):
        conn = mysql.connector.connect(host=HOST,
                                       user=USER,
                                       passwd=PASSWD,
                                       database=DATABASE)
        c = conn.cursor()

        c.execute(
            f"SELECT ip FROM costumers WHERE guild_id = '{ctx.get_guild().id}' AND ipname = '{ip}'"
        )
        result = c.fetchone()
        c.execute(
            f"SELECT lan FROM language WHERE guild_id = '{ctx.get_guild().id}'"
        )
        lang = c.fetchone()
        conn.commit()
        if result is not None:
            core = scraper.GTcore(result[0])
            title = core.name()
            banner = core.banner()
            scanned = core.scan()
            servermanager = core.servermanager()

            embed = hikari.Embed(title=title, color=COLOR)
            embed.add_field(name="Server Manager:", value=servermanager)
            embed.set_image("https:" + banner)
            embed.set_footer(text=scanned)
            await ctx.respond(embed=embed)
        else:
            core = scraper.GTcore(ip)
            if core.checkip() == False:
                await ctx.respond(
                    get_lang("en", "ip_error") if lang is None else get_lang(
                        lang[0], "ip_error"))
            else:
                title = core.name()
                banner = core.banner()
                scanned = core.scan()
                servermanager = core.servermanager()

                embed = hikari.Embed(title=title, color=COLOR)
                embed.add_field(name="Server Manager:", value=servermanager)
                embed.set_image("https:" + banner)
                embed.set_footer(text=scanned)
                await ctx.respond(embed=embed)
コード例 #6
0
    async def setname(self, ctx, ip : str, *, ipname : str):

        conn = mysql.connector.connect(
            host = HOST, 
            user = USER, 
            passwd = PASSWD,
            database = DATABASE
        )
        c = conn.cursor()

        core = scraper.GTcore(ip)
        c.execute(f"SELECT lan FROM language WHERE guild_id = '{ctx.get_guild().id}'")
        lans = c.fetchone()  

        if lans is not None:
            lan = lans[0]
        else:
            lan = "en"
        
        if core.checkip() == True and checkdata(ctx.get_guild().id):
            setn = list()
            count = 0

            c.execute(f"SELECT ipname FROM costumers WHERE guild_id = '{ctx.get_guild().id}'")
            results = c.fetchall()


            for result in results:
                setn.append(result[0])

            for i in range(len(setn)):
                if ipname == setn[i]:
                    count += 1

            if count == 1:
                await ctx.respond(get_lang(lan, "setname_set"))
            else:
                await ctx.respond(f"```ip: {ip}\nipname: {ipname}```")
                insert = (f"INSERT INTO costumers VALUES('{ip}', '{ipname}', '{ctx.get_guild().id}')")
                c.execute(insert)
                conn.commit()
        elif core.checkip() == False:
            await ctx.respond(get_lang(lan, "ip_error"))
        elif checkdata(ctx.get_guild().id) == False:
            await ctx.respond(get_lang(lan, "server_limit"))