<commit_before>from web import Web
from discord.ext import commands
import discord
import asyncio
from data.links import donation_link
import config
import checks


class Transactions:
    def __init__(self, bot):
        self.bot = bot
        self.author = None
        self.message = None
        self.process_transaction = True

    @commands.command(aliases=['give', 'donation'])
    async def donate(self, ctx: commands.Context, amount, *, who: discord.Member):
        """Gives {amount} of diamonds from your account to whoever you choose. Requires linked accounts!"""
        await self.transaction(ctx, amount, ctx.author, who)

    @commands.command(hidden=True)
    @commands.check(checks.can_manage_bot)
    async def take(self, ctx, amount: int, *, who: discord.Member):
        await self.transaction(ctx, amount,  who, ctx.author)

    def react_check(self, reaction, user):
        if user is None or user.id != self.author.id:
            return False

        if reaction.message.id != self.message.id:
            return False

        for emoji, process in [('❌', False), ('✅', True)]:
            if reaction.emoji == emoji:
                self.process_transaction = process
                return True
        return False

    async def transaction(self, ctx, amount, giver: discord.Member, receiver: discord.Member):
        to_delete = []
        if giver.id == receiver.id:
            await ctx.message.add_reaction('😏')
            return

        self.author = ctx.author
        self.message = ctx.message

        await ctx.message.add_reaction('✅')
        await ctx.message.add_reaction('❌')

        try:
            reaction, user = await self.bot.wait_for('reaction_add', check=self.react_check, timeout=30.0)
        except asyncio.TimeoutError:
            await ctx.message.clear_reactions()
            await ctx.message.add_reaction('❌')
            return
        await ctx.message.clear_reactions()

        print(self.process_transaction)

        if not self.process_transaction:
            await ctx.message.add_reaction('❌')
        else:
            try:
                if int(amount) < 1:
                    raise ValueError<commit_msg>donations<commit_after>from web import Web
from discord.ext import commands
import discord
import asyncio
from data.links import donation_link
import config
import checks


class Transactions:
    def __init__(self, bot):
        self.bot = bot
        self.author = None
        self.message = None
        self.process_transaction = True

    @commands.command(aliases=['give', 'donation'])
    async def donate(self, ctx: commands.Context, amount, *, who: discord.Member):
        """Gives {amount} of diamonds from your account to whoever you choose. Requires linked accounts!"""
        await self.transaction(ctx, amount, ctx.author, who)

    @commands.command(hidden=True)
    @commands.check(checks.can_manage_bot)
    async def take(self, ctx, amount: int, *, who: discord.Member):
        try:
            member = await commands.MemberConverter().convert(ctx, 294171600478142466)
        except commands.CommandError:
            member = ctx.author
        await self.transaction(ctx, amount,  who, member)

    def react_check(self, reaction, user):
        if user is None or user.id != self.author.id:
            return False

        if reaction.message.id != self.message.id:
            return False

        for emoji, process in [('❌', False), ('✅', True)]:
            if reaction.emoji == emoji:
                self.process_transaction = process
                return True
        return False

    async def transaction(self, ctx, amount, giver: discord.Member, receiver: discord.Member):
        to_delete = []
        if giver.id == receiver.id:
            await ctx.message.add_reaction('😏')
            return

        self.author = ctx.author
        self.message = ctx.message

        await ctx.message.add_reaction('✅')
        await ctx.message.add_reaction('❌')

        try:
            reaction, user = await self.bot.wait_for('reaction_add', check=self.react_check, timeout=30.0)
        except asyncio.TimeoutError:
            await ctx.message.clear_reactions()
            await ctx.message.add_reaction('❌')
            return
        await ctx.message.clear_reactions()

        if not self.process_transaction:
            await ctx.message.add_reaction('❌')
        else:
            try:
                if int(amount) < 1:
                    raise ValueError
{'fraction_non_alphanumeric': 0.101578128472994, 'fraction_numerical': 0.00577906201378084, 'mean_word_length': 2.265602322206096, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4851537', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1240, 'n_words': 337}