コード例 #1
0
async def resetFunny(ctx):
    if ctx.author.id == 380801506137473034:
        try:
            serverID = ctx.guild.id
            queueUp = dbFirstBankOfFunny[str(serverID)]
            inDb = queueUp.find()

            for entry in inDb:
                entryBalance = entry["Balance"]
                resetBal = entryBalance * -1
                print(entry["User"])
                print(entryBalance)
                print(resetBal)
                account = getAccount(entry["User ID"], serverID)
                try:
                    updateBalance(serverID, account, resetBal, False)
                    account = getAccount(entry["User ID"], serverID)
                    updateBalance(serverID, account, 100, False)
                except Exception:
                    print("Failed updateBalance")

                account = getAccount(entry["User ID"], serverID)
                entryWorked = account["Funny Worked"]
                resetWorked = entryWorked + (entryWorked * -1)
                try:
                    updateFunnyWorked(serverID, account, resetWorked)
                except Exception:
                    print("Failed update Funny Worked")
        except Exception:
            print("Failed")
    else:
        await ctx.send("Cringe-ass")
コード例 #2
0
async def give(ctx, member: discord.Member, funnyBucks: str):
    serverID = ctx.guild.id
    userID = ctx.message.author.id
    funnyMemberID = member.id
    if int(funnyBucks) == 0 or int(funnyBucks) < 0:
        await ctx.send("Who are you really helping here...?")
    elif int(funnyBucks) > 50:
        await ctx.send("That amount is too high for personal transactions." +
                       " Limit for personal transactions is 50 Funny")
    else:
        try:
            if checkIfAccountExists(funnyMemberID,
                                    serverID) and checkIfAccountExists(
                                        userID, serverID):

                checkIfAccountHasAllFields(serverID,
                                           getAccount(userID, serverID))
                checkIfAccountHasAllFields(serverID,
                                           getAccount(funnyMemberID, serverID))

                funnyAccount = getAccount(funnyMemberID, serverID)
                userAccount = getAccount(userID, serverID)

                if userAccount["Daily Funny Transactions"] <= 0:
                    await ctx.send(
                        "You do not have a sufficient amount of daily" +
                        " transactions available to charge for this funny." +
                        " Use `!account` to check that number.")
                else:
                    updateBalance(serverID, funnyAccount, int(funnyBucks),
                                  False)
                    updateBalance(serverID, userAccount,
                                  int(funnyBucks) * -1, True)

                    if int(funnyBucks) > 20:
                        await ctx.send(
                            ctx.message.author.name + " is giving " +
                            str(member.name) + " a whopping " + funnyBucks +
                            " funny bucks for making the whole squad laugh.")
                    else:
                        await ctx.send(ctx.message.author.name +
                                       " is giving " + str(member.name) + " " +
                                       funnyBucks +
                                       " funny for the nose-exhale.")
            else:
                await ctx.send(
                    "You or the user do not have a First Bank of Funny" +
                    " account. They will need to `!createFunnyAccount` " +
                    "before you can reward them for being funny!")
        except Exception as e:
            await ctx.send("Something went wrong...")
            await ctx.send(e)
            await ctx.send("Ping Memely till he starts fixing it...")
コード例 #3
0
async def thenIllMakeAFriendshipProblem(ctx, member: discord.Member):
    if ctx.author.id == 380801506137473034:

        ID = str(ctx.message.guild.id)

        user = member.name
        userID = member.id

        try:
            if not checkIfAccountExists(userID, ID):
                queueUp = dbFirstBankOfFunny[str(ID)]
                post_data = {
                    "User": user,
                    "User ID": userID,
                    "Balance": 100,
                    "Funny Credit Score": 500,
                    "Daily Funny Transactions": 5,
                    "Funny Wage": 10,
                    "Funny Worked": 0,
                }

                queueUp.insert_one(post_data)
                await ctx.send("Checking funny credit score for " +
                               member.name + "...")
                time.sleep(3)
                await ctx.send(
                    "Funny credit score is good. Creating account for " +
                    member.name +
                    "! Starting bonus is 100 funny bucks. Have a funny day!")
            else:
                account = getAccount(userID, ID)
                await ctx.send("You already have a funny account." +
                               " Im taking away 1 funny buck for that.......")
                updateBalance(ID, account, -1, False)

        except Exception as e:
            await ctx.send("Something went wrong...")
            await ctx.send(e)
            await ctx.send("Ping Memely till he starts fixing it...")
    else:
        await ctx.send("Cope")