Servers now have server spesific prefixes

This commit is contained in:
plane000
2018-05-22 18:49:07 +01:00
parent c0529d5dab
commit 825e1611f5
6 changed files with 30 additions and 15 deletions

View File

@@ -7,6 +7,10 @@ const Helper = require('../helper.js');
/*message object, messaage full, message args, discord client*/
module.exports.addadminrole = function(message, msg, args, discordclient) {
}
module.exports.stop = async function(message, msg, args, discordclient) {
message.channel.send(':white_check_mark: \`Disconnected...\`');
Logger.failed('Disconnected');
@@ -15,14 +19,23 @@ module.exports.stop = async function(message, msg, args, discordclient) {
module.exports.reload = async function(message, msg, args, discordclient) {
try {
Config.loadFromFile();
message.channel.send(':white_check_mark: \`Configuration reloaded...\`');
} catch (e) {
message.channel.send(`:no_entry_sign: \`Could not load the config: ${e.message}\``);
}
}
module.exports.setprefix = async function(message, msg, args, discordclient) {
if (args[1]) {
var servers = Config.getservers()
servers[message.guild.id].prefix = args[1]
Config.setservers(servers);
Config.writeToFile();
message.channel.send(`:white_check_mark: \`The prefix for ${message.guild.name} is now ${args[1]} \``);
} else {
message.channel.send(':no_entry_sign: \`No new prefix specified\`')
}
}
module.exports.setgame = async function(message, msg, args, discordclient) {

View File

View File

@@ -226,8 +226,8 @@ module.exports.vote = async function(message, msg, args, discordclient) {
}
async function startPoll(messageObj, args) {
var parsedOptions = await parseOptions(args);
var parsedVotes = await getVotes(parsedOptions)
var parsedOptions =args.slice(2).join(" ").match(/(\\.|[^/])+/g)
var parsedVotes = await getStartingVotes(parsedOptions)
polls[messageObj.guild.id] = {
options: parsedOptions,
votes: parsedVotes,
@@ -235,11 +235,7 @@ async function startPoll(messageObj, args) {
}
}
async function parseOptions(args) {
return args.slice(2).join(" ").match(/(\\.|[^/])+/g)
}
async function getVotes(options) {
async function getStartingVotes(options) {
var votes = [];
for (i in options) {
votes.push('0');