Coding Projects

Discord Bots

I created a Discord bot in order to help manage the inventory and currency balance of players for online role playing in discord servers. The bot also includes a shop system, gacha system, and simple commands such as rolling dice or flipping a coin. I've made several different iterations of the bot, improving its features each time. One of my goals is to have one that is capable of being run simultaneously on many servers, and have easily customizable options for server admins. Currently the database being used is MongoDB, though I am looking into switching over to PostgreSQL. The bot is coded with Python using discord.py.

Example of code for a 10 pull item gacha:

 
# Item gacha command
@client.command()
async def gacha10(ctx):
    author_id = ctx.author.id
    user = userdb.find_one({"_id": author_id})

    if not userdb.find_one({"_id": author_id}):
        await ctx.send("You are not registered")
    elif user["balance"] >= 50:
        prevbal = user["balance"]
        name = user["user"]
        rollcount = user["rollcount"]
        rollnumber = 10
        if "Special offer" in user["skills"]: # checks for bonus
            rollnumber += 1
        getstring = f"{name}! You got:"
        for i in range(rollnumber):
            get = randrange(0, gachacount)
            getitem = itemlist.find_one({"_id": get})
            getname = getitem["name"]
            userinventory = useritems.find_one({"_id": author_id})
            qty = userinventory[getname]
            useritems.update_one({"_id": author_id}, {"$set": {getname: qty + 1}})
            getstring = getstring + f"\n{getname}"
        bal = user["balance"] - 50
        rollcount += 10
        userdb.update_one({"_id": author_id}, {"$set": {"balance": bal}})
        userdb.update_one({"_id": author_id}, {"$set": {"rollcount": rollcount}})
        getstring += f"\n\nPrevious Balance: {prevbal}\nUpdated Balance: {bal}"
        await ctx.send(getstring)
    else:
        await ctx.send(f"You don't have enough coins! You only have {user['balance']}!")
                

Screenshots of Bot:

  • Regular User Commands for the bot.
  • Simple Game Commands.
  • Item Gacha Roll Command. Normally gacha10 would do a 10 roll, but with a special skill, it becomes an 11 roll.
  • Inventory Command. The final page has skills and non-gacha items listed.
  • Locked Command: Adding Coins. Only people with specified roles can use the command.
  • Card Gacha Command. A different version of the bot that had a card gacha showing the card images.
  • Visual Novel Game

    I will be working on the coding for a visual novel game titled Total Upheaval by vcentei. The initial programming was done by another person, so the current demo does not contain my work. The project's engine will be switched to Ren'py.