# Buggy code
async def _set(self, ctx: commands.Context, to: discord.Member, creds: SetParser):
    """Set the balance of user's bank account.

    Passing positive and negative values will add/remove currency instead.

    Examples:
    - `[p]bank set @Twentysix 26` - Sets balance to 26
    - `[p]bank set @Twentysix +2` - Increases balance by 2
    - `[p]bank set @Twentysix -6` - Decreases balance by 6
    """
    author = ctx.author
    currency = await bank.get_currency_name(ctx.guild)

    if creds.operation == "deposit":
        await bank.deposit_credits(to, creds.sum)
        await ctx.send(
            _("{author} added {num} {currency} to {user}'s account.").format(
                author=author.display_name,
                num=creds.sum,
                currency=currency,
                user=to.display_name,
            )
        )
    elif creds.operation == "withdraw":
        await bank.withdraw_credits(to, creds.sum)
        await ctx.send(
            _("{author} removed {num} {currency} from {user}'s account.").format(
                author=author.display_name,
                num=creds.sum,
                currency=currency,
                user=to.display_name,
            )
        )
    else:
        await bank.set_balance(to, creds.sum)
        await ctx.send(
            _("{author} set {user}'s account balance to {num} {currency}.").format(
                author=author.display_name,
                num=creds.sum,
                currency=currency,
                user=to.display_name,
            )
        )


# Traceback (OverflowError)
ERROR events on_command_error 205: Exception in command 'bank set'
Traceback (most recent call last):
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/discord/ext/commands/core.py", line 61, in wrapped
ret = await coro(*args, **kwargs)
File "/home/zephyrkul/.pyenv/versions/3.7.0/envs/red/lib/python3.7/site-packages/redbot/cogs/economy/economy.py", line 206, in _set
await bank.set_balance(to, creds.sum)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/redbot/core/bank.py", line 181, in set_balance
await group.balance.set(amount)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/redbot/core/config.py", line 152, in set
await self.driver.set(*self.identifiers, value=value)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/redbot/core/drivers/red_mongo.py", line 95, in set
upsert=True,
File "/home/zephyrkul/.pyenv/versions/3.7.0/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/collection.py", line 995, in update_one
session=session),
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/collection.py", line 851, in _update_retryable
_update, session)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/mongo_client.py", line 1243, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/mongo_client.py", line 1196, in _retry_with_session
return func(session, sock_info, retryable)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/collection.py", line 847, in _update
retryable_write=retryable_write)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/collection.py", line 817, in _update
retryable_write=retryable_write).copy()
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/pool.py", line 584, in command
self._raise_connection_failure(error)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/pool.py", line 745, in _raise_connection_failure
raise error
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/pool.py", line 579, in command
unacknowledged=unacknowledged)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/network.py", line 114, in command
codec_options, ctx=compression_ctx)
File "/home/zephyrkul/.pyenv/versions/red/lib/python3.7/site-packages/pymongo/message.py", line 679, in _op_msg
flags, command, identifier, docs, check_keys, opts)
OverflowError: MongoDB can only handle up to 8-byte ints

# Fixed code
async def _set(self, ctx: commands.Context, to: discord.Member, creds: SetParser):
    """Set the balance of user's bank account.

    Passing positive and negative values will add/remove currency instead.

    Examples:
    - `[p]bank set @Twentysix 26` - Sets balance to 26
    - `[p]bank set @Twentysix +2` - Increases balance by 2
    - `[p]bank set @Twentysix -6` - Decreases balance by 6
    """
    author = ctx.author
    currency = await bank.get_currency_name(ctx.guild)

    try:
        if creds.operation == "deposit":
            await bank.deposit_credits(to, creds.sum)
            msg = _("{author} added {num} {currency} to {user}'s account.").format(
                author=author.display_name,
                num=creds.sum,
                currency=currency,
                user=to.display_name,
            )
        elif creds.operation == "withdraw":
            await bank.withdraw_credits(to, creds.sum)
            msg = _("{author} removed {num} {currency} from {user}'s account.").format(
                author=author.display_name,
                num=creds.sum,
                currency=currency,
                user=to.display_name,
            )
        else:
            await bank.set_balance(to, creds.sum)
            msg = _(
                "{author} set {user}'s account balance to {num} {currency}."
            ).format(
                author=author.display_name,
                num=creds.sum,
                currency=currency,
                user=to.display_name,
            )
    except (ValueError, errors.BalanceTooHigh) as e:
        await ctx.send(str(e))
    else:
        await ctx.send(msg)