예제 #1
0
    def is_user_registered(self, discord_id, random_string):
        conn = DB(data_dir=self.bot.data_dir).connection

        if conn is None:
            return False

        cursor = conn.cursor()

        cursor.execute("SELECT * FROM github_users WHERE discord_id={}".format(
            discord_id))

        rows = cursor.fetchone()

        if rows is not None:
            conn.close()
            return True

        cursor.execute(
            "SELECT * FROM pending_users WHERE discord_id={}".format(
                discord_id))

        row = cursor.fetchone()

        if row is not None:
            cursor.execute(
                "DELETE FROM pending_users WHERE discord_id={}".format(
                    discord_id))

        cursor.execute(
            "INSERT INTO pending_users(discord_id, verification) VALUES(?, ?);",
            (discord_id, random_string))

        conn.commit()
        conn.close()
        return False
예제 #2
0
def delete_pending(discord_id):
    conn = DB(data_dir=app.config["data_dir"]).connection

    cursor = conn.cursor()
    cursor.execute(f"DELETE FROM pending_users WHERE discord_id={discord_id}")

    conn.commit()
예제 #3
0
def delete_pending(discord_id):
    conn = DB(data_dir=app.config['data_dir']).connection

    cursor = conn.cursor()
    cursor.execute("DELETE FROM pending_users WHERE discord_id={}".format(discord_id))

    conn.commit()
예제 #4
0
 async def remover(self, member):
     try:
         conn = DB(data_dir=self.bot.data_dir).connection
         cursor = conn.cursor()
         cursor.execute(f"DELETE FROM github_users WHERE discord_id={member.id}")
         conn.commit()
         self.bot.logger.info("%s left, purged from database", member.name)
     except:
         pass
예제 #5
0
    async def remove(self, ctx):
        user_mention = "<@{}>: ".format(ctx.author.id)
        conn = DB(data_dir=self.bot.data_dir).connection

        cursor = conn.cursor()

        cursor.execute("DELETE FROM github_users WHERE discord_id={}".format(
            ctx.author.id))

        conn.commit()

        return await ctx.send(user_mention + "fjernet Githuben din.")
예제 #6
0
    async def remove(self, ctx):
        """
        Kommando for å fjerne kobling mellom Github- og Discord-bruker
        """
        conn = DB(data_dir=self.bot.data_dir).connection

        cursor = conn.cursor()

        cursor.execute(f"DELETE FROM github_users WHERE discord_id={ctx.author.id}")

        conn.commit()

        return await ctx.send(ctx.author.mention + "fjernet Githuben din.")
예제 #7
0
def insert_user(discord_id, auth_token, github_username):
    conn = DB(data_dir=app.config['data_dir']).connection

    if conn is None:
        return False

    cursor = conn.cursor()

    params = (discord_id, auth_token, github_username)

    cursor.execute("INSERT OR REPLACE INTO github_users(discord_id, auth_token, github_username) VALUES(?, ?, ?);", params)
    conn.commit()

    conn.close()
    return True