mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-15 05:36:54 +00:00
Changed the Mongodb structure to include what's in the database, added the 'r' and 'reactionrole' commands
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
function checkRole(message, args) {
|
||||||
|
let role = args[0];
|
||||||
|
if (message.member.hasPermission('ADMINISTRATOR')) { return true; }
|
||||||
|
|
||||||
|
/*Maybe implement this later, useless for now
|
||||||
|
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
||||||
|
client.connect(err => {
|
||||||
|
|
||||||
|
|
||||||
|
const role = client.db(message.guild.id).collection("admin-roles");
|
||||||
|
shop.find().toArray(function(err, itemstemp) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
items = [...itemstemp];
|
||||||
|
|
||||||
|
client.close();
|
||||||
|
});
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {name: 'verify', checkRole}
|
||||||
@@ -211,7 +211,7 @@ module.exports = {
|
|||||||
|
|
||||||
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
||||||
client.connect(err => {
|
client.connect(err => {
|
||||||
const db = client.db(server);
|
const db = client.db(String(server) + "[ECON]");
|
||||||
const dbo = db.collection(id);
|
const dbo = db.collection(id);
|
||||||
if (err) { return console.log(err); }
|
if (err) { return console.log(err); }
|
||||||
//Initialize if necessary
|
//Initialize if necessary
|
||||||
@@ -225,6 +225,7 @@ module.exports = {
|
|||||||
|
|
||||||
//test area
|
//test area
|
||||||
if (command == 'xp' || command == 'adbal') {
|
if (command == 'xp' || command == 'adbal') {
|
||||||
|
//Selmer Dev only command
|
||||||
if (message.member.roles.cache.has('944048889038774302')) {
|
if (message.member.roles.cache.has('944048889038774302')) {
|
||||||
if (command == 'xp') {
|
if (command == 'xp') {
|
||||||
return addxp(message, dbo, Number(args[0]), xp_list);
|
return addxp(message, dbo, Number(args[0]), xp_list);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: 'reactionrole',
|
||||||
|
description: 'Creates an embed that will give a role when reacted to',
|
||||||
|
async execute(message, args, Discord, bot) {
|
||||||
|
if (bot.commands.get('verify').checkRole(message, args)) {
|
||||||
|
console.log("IS ADMNIN");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const { Client, Intents } = require('discord.js');
|
const { Client, Intents, Permissions } = require('discord.js');
|
||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const { MongoClient, ServerApiVersion } = require('mongodb');
|
const { MongoClient, ServerApiVersion } = require('mongodb');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
@@ -27,14 +27,20 @@ const mongouri = process.env.MONGODB_URI;
|
|||||||
const { connect } = require('mongoose');
|
const { connect } = require('mongoose');
|
||||||
|
|
||||||
bot.on("guildCreate", guild => {
|
bot.on("guildCreate", guild => {
|
||||||
// guild.owner.send('Thanks! You can use +help to discover commands.')
|
guild.members.fetch
|
||||||
|
guild.roles.create({ name: 'Selmer Bot Mod' });
|
||||||
|
/*
|
||||||
|
const role = guild.roles.cache.find((role) => role.name === 'Selmer Bot Mod'); // member.roles.cache.has('role-id-here');
|
||||||
|
let owner = guild.members.fetch(guild.ownerID);
|
||||||
|
owner.send('Thank you for adding Selmer Bot to your server!\nPlease give people you want to have access to Selmer Bot\'s restricted commands the <@&' + role + '> role.');
|
||||||
|
*/
|
||||||
|
|
||||||
//Get total inventory
|
//Get custom inventory
|
||||||
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
||||||
client.connect(err => {
|
client.connect(err => {
|
||||||
const collection = client.db(guild).collection("shop");
|
const collection = client.db(String(guild)).collection("shop");
|
||||||
// perform actions on the collection object
|
// perform actions on the collection object
|
||||||
console.log(guild);
|
collection.insertOne({ owner: guild.ownerId });
|
||||||
client.close();
|
client.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -93,7 +99,6 @@ bot.on('ready', async () => {
|
|||||||
|
|
||||||
//Reaction map area
|
//Reaction map area
|
||||||
|
|
||||||
|
|
||||||
console.log('SLEEMER BOT ONLINE!!!!! OH MY GOD OH MY GOD!!!');
|
console.log('SLEEMER BOT ONLINE!!!!! OH MY GOD OH MY GOD!!!');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -108,8 +113,10 @@ bot.on('messageCreate', (message) => {
|
|||||||
|
|
||||||
//Check if the user has sufficient permission
|
//Check if the user has sufficient permission
|
||||||
//Performes the command
|
//Performes the command
|
||||||
|
//Admin section
|
||||||
|
if (command == 'reactionrole') { bot.commands.get(command).execute(message, args, Discord, bot); }
|
||||||
|
|
||||||
if(bot.commands.has(command)) { bot.commands.get(command).execute(message, args, Discord, Client, bot); }
|
else if(bot.commands.has(command)) { bot.commands.get(command).execute(message, args, Discord, Client, bot); }
|
||||||
|
|
||||||
else { bot.commands.get('ECON').execute(bot, message, args, command, Discord, mongouri, items, xp_collection); }
|
else { bot.commands.get('ECON').execute(bot, message, args, command, Discord, mongouri, items, xp_collection); }
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user