<commit_before>import sqlite3
from discord.ext import commands

memebuck = '[̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]'


class Memebucks:
    def __init__(self, yeebot):
        self.yeebot = yeebot
        self.conn = sqlite3.connect('db/yee.db')
        self.cur = self.conn.cursor()
    
    @commands.group(pass_context=True)
    async def memebucks(self, ctx):

        sender = ctx.message.author
        self.cur.execute("SELECT meme_bucks FROM users WHERE user_id = ?;",
                         (sender.id,))
        row = self.cur.fetchone()
        if row:
            return await self.yeebot.say('{}, your balance is {} memebucks.'
                                         .format(sender.name, row[0]))
        else:
            self.cur.execute("INSERT INTO users (user_id, username, meme_buck"
                             "s) VALUES (?,?,?);",
                             (sender.id, sender.name, 100))
            self.conn.commit()
            return await self.yeebot.say('Congratulations! You have establish'
                                         'ed an account with the Bank of Meme'
                                         'rica! Your account balance is\n{} *'
                                         '*100** {}'
                                         .format(memebuck, memebuck))

    @memebucks.command(pass_context=True)
    async def balance(self, ctx):
        pass

    @memebucks.command(pass_context=True)
    async def give(self, ctx, user, amount):
        pass


def setup(yeebot):
    yeebot.add_cog(Memebucks(yeebot))
<commit_msg>refactored memebucks.py<commit_after>import sqlite3
from discord.ext import commands
from bank import Bank

memebuck = '[̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]'


def account_exists(ctx):
    return Bank.check_if_exists(ctx.message.author.id)

class Memebucks:
    def __init__(self, yeebot):
        self.yeebot = yeebot
        self.conn = sqlite3.connect('db/yee.db')
        self.cur = self.conn.cursor()
    
    @commands.group(pass_context=True)
    async def memebucks(self, ctx):
        
        if not Bank.check_if_exists(ctx.message.author.id):
            self.cur.execute("INSERT INTO users (user_id, username, meme_bucks) VALUES (?,?,?);",
                             (sender.id, sender.name, 100))
            self.conn.commit()
            return await self.yeebot.say('Congratulations! You have establish'
                                         'ed an account with the Bank of Meme'
                                         'rica! Your account balance is\n{} *'
                                         '*100** {}'
                                         .format(memebuck, memebuck))
        else:
            self.yeebot.say('What would you like to do with memebucks? !help memebucks for more.')
    
    @commands.check(account_exists)
    @memebucks.command(pass_context=True)
    async def balance(self, ctx):
        balance = Bank.check_balance()
        self.yeebot.say('{}, your balance is {}.'.format(ctx.message.author.name, balance))
    
    @commands.check(account_exists)
    @memebucks.command(pass_context=True)
    async def give(self, ctx, user, amount):
        balance = Bank.check_balance()
        if balance >= amount:
            Bank.transfer(ctx.message.author.id, user.id, amount)
            self.yeebot.say('{} memebucks given to {}.'.format(amount, user.name))


def setup(yeebot):
    yeebot.add_cog(Memebucks(yeebot))

{'fraction_non_alphanumeric': 0.12426900584795321, 'fraction_numerical': 0.004970760233918129, 'mean_word_length': 1.8249380677126341, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 19, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4465573', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1032, 'n_words': 225}