fixed typo

merge-requests/1/head
loicbersier 6 years ago
parent a052a7a52b
commit 72ad8244c4

@ -1,15 +1,15 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const fs = require('fs'); const fs = require('fs');
class shamoeboardCommand extends Command { class shameboardCommand extends Command {
constructor() { constructor() {
super('shamoeboard', { super('shameboard', {
aliases: ['shamoeboard'], aliases: ['shameboard'],
category: 'admin', category: 'admin',
channelRestriction: 'guild', channelRestriction: 'guild',
userPermissions: ['ADMINISTRATOR'], userPermissions: ['ADMINISTRATOR'],
description: { description: {
content: 'Set shamoeboard', content: 'Set shameboard',
usage: '[]', usage: '[]',
examples: [''] examples: ['']
} }
@ -17,27 +17,27 @@ class shamoeboardCommand extends Command {
} }
async exec(message) { async exec(message) {
let shamoeboardChannel = message.channel.id; let shameboardChannel = message.channel.id;
fs.readFile(`./shamoeboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data){ fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data){
if (err){ if (err){
fs.writeFile(`./shamoeboard/${message.guild.id}.json`, `{"shamoeboard": "${shamoeboardChannel}"}`, function (err) { fs.writeFile(`./starboard/${message.guild.id}.json`, `{"shameboard": "${shameboardChannel}"}`, function (err) {
if (err){ if (err){
console.log(err); console.log(err);
} }
return message.channel.send(`This channel have been set as the shamoeboard`); return message.channel.send(`This channel have been set as the shameboard`);
}) })
} else { } else {
let shamoeboard = JSON.parse(data); //now it an object let shameboard = JSON.parse(data); //now it an object
shamoeboard ['shamoeboard'] = shamoeboardChannel; shameboard ['shameboard'] = shameboardChannel;
var json = JSON.stringify(shamoeboard); //convert it back to json var json = JSON.stringify(shameboard); //convert it back to json
fs.writeFile(`./shamoeboard/${message.guild.id}.json`, json, 'utf8', function(err) { fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function(err) {
if(err) { if(err) {
return console.log(err); return console.log(err);
} }
})}}); })}});
return message.channel.send(`This channel have been set as the shamoeboard`); return message.channel.send(`This channel have been set as the shameboard`);
} }
} }
module.exports = shamoeboardCommand; module.exports = shameboardCommand;
Loading…
Cancel
Save