PiggyBank Discord Bot

Test this app for free
21
import io
import aioschedule
from crud import delete_wishlist_item, edit_subscription, delete_subscription, create_subscription, view_recurring_subscriptions, view_non_recurring_subscriptions, set_account_amount, get_wishlist, update_wishlist_item, set_investment_value, delete_investment, get_investments_for_user, update_tag, get_transactions_for_user, create_investment, create_wishlist_item, create_transaction, get_user, get_all_tags, create_account, get_account, get_all_accounts, delete_account, update_account_amount, create_tag, delete_tag, get_budget, update_budget
from fetch_currencies import fetch_currencies, convert_currency
from analytics import all_in_one_analysis, get_investment_statistics, generate_spending_report
from flask import Flask
from app_init import app, tree, bot, bot_token
import discord
from discord import app_commands, Interaction
from sqlalchemy.exc import IntegrityError
import os
from discord.ui import Select, View
import asyncio
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from database import db
from accounts import *
from stats import *
from tags import *
from investments import *
from subscriptions import *
from wishlist import *
from budgets import *

scheduler = AsyncIOScheduler()
Get full code

Created: | Last Updated:

This app is a Discord bot that allows users to track various aspects of their finances such as accounts, spending types, wishlist items, transactions, investments, and many more!

Here's a step-by-step guide for using the PiggyBank Discord Bot template:

Introduction

The PiggyBank Discord Bot is a powerful financial tracking tool that integrates with Discord. It allows users to manage various aspects of their finances, including accounts, spending categories, wishlist items, transactions, investments, and more. This bot can help Discord users keep track of their financial health directly within their Discord server.

Getting Started

To begin using this template:

  1. Click the "Start with this Template" button in the Lazy Builder interface.

Initial Setup

Before testing the bot, you need to set up a Discord bot and obtain its token. Follow these steps:

  1. Go to the Discord Developer Portal (https://discord.com/developers/applications).
  2. Click "New Application" and give your application a name.
  3. Navigate to the "Bot" section in the left sidebar.
  4. Click "Add Bot" to create a bot user for your application.
  5. Under the "TOKEN" section, click "Reset Token" to generate a new token. Confirm by clicking "Yes, do it!"
  6. Copy the generated token.
  7. In the Lazy Builder, go to the "Environment Secrets" tab.
  8. Add a new secret with the key DISCORD_BOT_TOKEN and paste your bot token as the value.

Additionally, you need to set up an API key for currency conversion:

  1. Go to https://www.exchangerate-api.com/
  2. Sign up for a free account.
  3. Once logged in, copy your API key from the dashboard.
  4. In the Lazy Builder's "Environment Secrets" tab, add another secret with the key EXCHANGE_RATE_API_KEY and paste your API key as the value.

Testing the Bot

After setting up the environment secrets:

  1. Click the "Test" button in the Lazy Builder interface to start the deployment process.

Using the Bot

Once the bot is deployed, you can invite it to your Discord server:

  1. Go back to the Discord Developer Portal and select your application.
  2. Navigate to the "OAuth2" section in the left sidebar.
  3. In the "Scopes" section, select "bot".
  4. In the "Bot Permissions" section, select the permissions your bot needs (at minimum: Read Messages/View Channels, Send Messages, Use Slash Commands).
  5. Copy the generated OAuth2 URL.
  6. Open this URL in a new browser tab and select the Discord server where you want to add the bot.

After adding the bot to your server, you can start using its commands. Here are some example commands:

  • /new_account: Create a new financial account
  • /spent: Record an expense
  • /money_in: Record income
  • /view_transactions: View your transaction history
  • /new_tag: Create a new spending category
  • /new_investment: Add a new investment
  • /new_subscription: Add a recurring subscription
  • /view_wishlist: View your wishlist items
  • /net_worth: Calculate your net worth

Each command will guide you through the process of entering the required information.

Integrating the Bot

This Discord bot is designed to work within Discord servers. There's no additional integration required beyond adding it to your desired Discord server and using its commands.

Remember to keep your bot token and API keys secure. Never share them publicly or commit them to version control systems.

Technologies

Discord Automation & Bots Discord Automation & Bots

Similar templates

We found some blogs you might like...