-
-
Save Kittyasd/b6a828ad1915ac82c494f37457567bf4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const botconfig = require("./botconfig.json"); | |
const Discord = require("discord.js"); | |
const bot = new Discord.Client(); | |
const mongoose = require("mongoose"); | |
const url = "mongodb://localhost:27017/money"; | |
mongoose.connect(url, { useNewUrlParser: true }); | |
const BountySchema = mongoose.Schema({ | |
userID: String, | |
money: Number | |
}) | |
var Money = mongoose.model("Money", BountySchema); | |
bot.on("message", async message => { | |
let prefix = botconfig.prefix; | |
let messageArray = message.content.split(" "); | |
let cmd = messageArray[0]; | |
let args = messageArray.slice(1); | |
if(cmd === `${prefix}givebounty`){ | |
let quantit = Number(args.join(" ").slice(22)); | |
let quantity = quantit*1; | |
Money.findOneAndUpdate({ | |
userID: message.author.id}, | |
(money) => { | |
money.money = money.money + quantity; | |
}) | |
} | |
}) | |
bot.login(botconfig.token); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment