GithubHelp home page GithubHelp logo

thetypingmatch / lecashbot Goto Github PK

View Code? Open in Web Editor NEW
17.0 5.0 11.0 4.14 MB

A Discord.js economy bot based on the NitroType currency made with JavaScript.

Home Page: https://lecashbot.cf

License: MIT License

JavaScript 100.00%
nitrotype-bot discord-bot discord discord-js bot lecashbot le-cash-bot

lecashbot's Introduction

LeCashBot

A Discord.js bot based on the NitroType currency.

Commands

Register
  • $register - Make a profile using your NitroType account.
  • $delete - Delete your LeCashBot account.
Guides
  • $invite - Invite the bot.
  • $info - Important bot information.
  • $stats - Show the bot servers/users and latency.
  • $uptime - Show the bot uptime.
  • $faq - Display frequently asked questions.
  • $ping - Show bot latency.
  • $donate - Display donators.
  • $contributors - Display contributors.
Economy
  • $bal - View yours or another user's balance.
  • $give - Gift someone cash from your balance.
  • $daily - Collect a daily bonus of cash based on your daily streak.
  • $total - View the amount of cash there exists in the economy.
  • $profile - View yours or another user's profile.
  • $withdraw - Withdraw at least $100K from your LeCashBot account to your NitroType account.
  • $leaderboard - View the wealthiest of all LeCashBot users.
Games
  • $bet - Play roulette for a chance to win cash.
  • $coinflip - Earn cash based on a coin flip streak.
  • $lottery - Enter a daily/weekly/monthly lottery for a chance to win the jackpot.
Miscellaneous
  • $report - Get a link for bug report.
  • $suggest - Get a link for feature suggestions.

Prerequisites

Name Installation Documentation
Node.js nodejs.org/en/download nodejs.org/en/docs
MongoDB docs.mongodb.com/manual/installation docs.mongodb.com
Discord.js yarn add discord.js discord.js.org/#/docs

Contributing

  1. Fork the repository
  2. Clone the repository & install required dependencies:
git clone [email protected]:YOUR_GITHUB_USERNAME/lecashbot.git
yarn

Setup

NOTE: Testing the application using a database on your own machine will require a localhost MongoDB database setup.

  1. Create a .env in the root directory of the repository.
  2. Inside of the .env file, include the following:
DISCORD_TOKEN="<token>"
MONGODB_URI="<uri>"

Replace <uri> and <token> with your MongoDB database connection URI and bot token. 3. Run the bot.

yarn start

lecashbot's People

Contributors

damienvesper avatar dependabot[bot] avatar goodgradesboy avatar iwa avatar mcglasses02 avatar rharr-6306 avatar ryan-harrington avatar techy avatar valkyrienyanko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lecashbot's Issues

Guess That Car Bot Game

Is your feature request related to a problem? Please describe.
This is a popular request from users.

Describe the solution you'd like
Grab all the images of all the cars in NitroType.
Edit them so that they are outlines.

When users try to guess the car, they give the car name and depending on how many guesses it takes, they will be rewarded.

Users will have an option to give up and will lose cash.

Command cooldowns

As the bot is being invited to more and more servers, a command cooldown is necessary to prevent spamming of the bot. This could go two ways:

  • Set the same cooldown for every command
  • Make individual cooldown times for each command

Organize User Mongoose model

This is a mess:

const mongoose = require('mongoose')

const articleSchema = new mongoose.Schema({
    date: {
        type: Object,
        required: true
    },
    name: {
        type: String,
        required: true
    },
    nitroTypeLink: {
        type: String,
        required: true
    },
    discordId: {
        type: String,
        required: true
    },
    discordTag: {
        type: String,
        required: true
    },
    balance: {
        type: Number,
        required: false,
        default: 0
    },
    dailyStreak: {
        type: Number,
        required: false,
        default: 0
    },
    donated: {
        type: Boolean,
        required: false,
        default: false
    },
    banned: {
        type: Boolean,
        required: false,
        default: false
    },
    highestBet: {
        type: Object,
        required: false,
        default: {
            chance: 0,
            amount: 0
        }
    },
    cooldowns: {
        type: Object,
        required: false,
        default: {
            bet: 0,
            daily: 0,
            delete: new Date(),
            coinflip: 0,
            give: 0,
            report: 0,
            suggest: 0,
            withdraw: 0
        }
    },
    donations: {
        type: Number,
        required: false,
        default: 0
    },
    dev: {
        type: Boolean,
        required: false,
        default: false
    },
    admin: {
        type: Boolean,
        required: false,
        default: false
    },
    donor: {
        type: Boolean,
        required: false,
        default: false
    },
    tester: {
        type: Boolean,
        required: false,
        default: false
    },
    owner: {
        type: Boolean,
        required: false,
        default: false
    }
})

module.exports = mongoose.model('Article', articleSchema)

Linter

May I add eslint? It will enforce a standard code style.

LeCashBot is typing...

Have LeCashBot start "typing" before a command is run and stop the typing after the command is complete.

$coinflip take

This feature allows users to reset their streak and take the earnings they've got.

$help command categories

As more commands are created, the help command description is getting too large. It can be split into the following categories:

  • Register
  • Guides
  • Economy
  • Games
  • Misc.

3 second cooldown for all commands

Is your feature request related to a problem? Please describe.
There is a problem with command spamming in some servers.

Describe the solution you'd like
Add a 3 second cool down to all commands.

Discord.js v12 is incompatible with Node.js v10

LeCashBot runs on a Debian 8 server. With the new Discord.js v12 update, Debian 8 seems to be incompatible with the new version. I believe Discord.js v11 requires NodeJS v6.0.0 or higher but Discord.js v12 requires NodeJS v12.0.0 or higher. The highest version Debian 8 seems to support is NodeJS v10. Any suggestions on solutions?

Donor list Discord ID instead of name

Instead of listing out all of the names of users who have donated to the bot, list their Discord ID and fetch the username & tag before listing them.

LeCashBot triggers every time a message begins with "$".

Every time a message begins with the symbol "$", LeCashBot is triggered into saying "That command doesn't exist!" regardless of whether it is a command or not. This is getting annoying. Perhaps you can remove this feature altogether. If a command doesn't exist, the bot does not respond at all.

Nodemon

Nodemon will auto restart your bot whenever you make and save changes to a js file. Let me know if you want me to implement this into the start up script.

Banning for a Set Period

When using the $ban command, an admin/developer should be able to specify a set period for how long a user will be banned for, depending on how severe a particular offense is. If they don't specify, the ban is permanent and will continue until the $unban command is used. The $unban command be use at any time to unban immediately.

ex.) $ban [user] 1w => user is banned from using commands for 1 week

Leaderboard Placement

I thought it was cool to check your personal place on the cash leaderboard, so I am wondering if we can get that back. I am also wondering if the alias $lb could be added because that makes it much faster.

[$daily] Command Bug

Describe the bug
I used the $daily command in #bot-commands of the NT discord server, and LeCashBot responded by saying, "You can collect your daily reward in 0 minutes".

To Reproduce
I'm not sure how to reproduce this bug, however, I believe its cause was due to me using the $daily command < 0.5 minutes too early, as a result of the bot rounding the minutes down to 0.

Expected behavior
I expected to receive my daily as usual or the bot responding and saying, "You can collect your daily reward in n (where n /= 0) minutes".

Screenshots
Screenshot is provided here: https://imgur.com/a/o9ciXVg

Desktop (please complete the following information):

  • OS: macOS 10.12.6
  • Firefox 75.0 (up to date)

$delete command

Users should be able to delete their user data if they want to since their Discord ID, tag, & name is stored.

Stealing money from users

You can steal money from people with the $give command.

Steps to reproduce the behavior:

  1. Type $give
  2. Add a letter directly to the end of the amount.
  3. It will bypass the minimum requirement, even if the value is negative.
  4. Money stolen.

I would think that it SHOULD say "invalid amount".

We found it here with positive numbers (0<x<100): https://discord.com/channels/564880536401870858/564881617630396426/708708072993980486
I tested it here with a negative number: https://discord.com/channels/564880536401870858/564881617630396426/708709241581731883

"Give contribution role" dev & admin command

As more users test the bot and donate, it would be easier for the user to ask an Admin or Developer to give them a role for their profile and be able to run a command.

For example: $contribute <userId or Tag> <contribution => $contribute 296862365503193098 tester

$daily upvote

Is your feature request related to a problem? Please describe.
Right we can just do $daily to collect free NT cash without having to actually do anything to give anything back to the bot or show any support. Members gain money while the bot is losing money. It's a win-lose situation. It's kinda not fair.

Describe the solution you'd like
A win-win situation for both parties.

Describe alternatives you've considered
Add a requirement to collect $daily. They need to upvote the bot first in order to claim their dailies. This is a thing for many other popular bots too. Like with some pokemon bot and waifu bot and RPG bot, you can't collect your daily unless you upvote them.

Additional context
All these are just different ideas
Image 1 : Maybe add the upvote link to $donate or $help
1

Image 2 : Or add it in the footnote
2

And then the following two choices:
Message appears when you try to do $daily

Image 3 : Get nothing at all unless they vote
3

Image 4 : Still get their daily streak even if they don't vote, just without the upvote bonuses
4

Never Gonna Give You Up

Lottery command feature

This is a feature I plan on adding in v2.0.0 of LeCashBot.

  • $lottery - View lottery information
    • Prize pool
    • Entry cost
    • When the lottery ends/started
    • How to enter
  • $lottery enter - Enter the lottery
    • Warns the user if they do not have enough to enter
    • Replying message confirming how much has been spent

These lotteries may last on a weekly interval with a $100, $1,000, or $10,000 entry fee.

Easter egg

Add a easter egg for the lecashbot to install or add Potato.exe

Command Unit Testing

Is your feature request related to a problem? Please describe.
There are currently no unit tests for any of the commands.

Describe the solution you'd like
Write unit tests for each command.

$leaderboard help categories

Since the leaderboard has more than 1 option, users should be able to see a guide on how to use the command for the following features it provides:

  • $leaderboard
  • $leaderboard bet
  • $leaderboard streak

Register by NitroType username

Users should be able to register for the bot using their nitrotype username. The bot will verify that the link exists and returns an error otherwise.

Coinflip bot game

Currently, there is 1 bot game available for a chance to earn extra cash for LeCashBot and that is the $bet command. Previously, the bot featured a $coinflip command as well but it was basically the $bet command but with a constant chance of 50% to win.

This coinflip game should be similarly structured to the $daily command; a win streak rewards users starting at a $100 reward and doubling for every streak win.

For example, the coinflip data may be stored like this:

coinflip: {
    type: Object, 
    required: false, 
    default: {
        currentStreak: 0, 
        highestStreak: 0
    }
},

...and rewards may be decided similar to the following:

// f(x) = 100 * 2^(x-1)
const reward = 100 * (2 ** (streak - 1))

Streaks may also be displayed on user profiles as well. Additionally, there may be a leaderboard for the highest win streaks.

Wrong Profile Picture When Summoning Other Users' Profile

I am unsure whether this is a bug or whether it was intentional. Whenever you check a user's profile with $bal or $profile, it shows up their information. However, if you look to the top left, it shows your profile. Shouldn't it show the user's profile?

Modular Events

Your events are all scrunched in one file index.js

I can spread them all out into individual files in a folder called events.

Let me know if you want me to do it and I'll create a PR

Project Structure Layout

Consider putting README.md and commands.md (should be COMMANDS.md) in .github folder. Also index.js and config folders should be in src folder.

$give command searches by user name

When performing the $give command, one currently needs to ping someone or provide their ID. However, one should also be able to just put someone's username for the bot to search, similar to how the $profile and $bal command does not require one to ping or provide an ID.

Find user by Discord name

Currently, users can search balances & profiles by tagging another user or their Discord ID. Since Discord names are tracked & updated frequently, other users should be able to search by Discord name.

$stats command

This command will show certain statistics of the bot currently. For example:

  • Servers
  • Users
  • Latency
  • Up-time
  • Any other suggestions?

Profile badges

When viewing a profile, developers, testers, donators, & admins should have special colors/badges on their profile when another user views one.

Streak leaderboard

I know this is also something we used to have, $leaderboard daily or $leaderboard streak, I can't remember which. Would actually make me on the leaderboard for something :P

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.