forked from Supositware/Haha-Yes
a webhook per channel
This commit is contained in:
parent
c940aa8d3e
commit
46ea458595
1 changed files with 4 additions and 4 deletions
|
@ -20,7 +20,7 @@ class fakebotCommand extends Command {
|
||||||
id: 'message',
|
id: 'message',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
prompt: {
|
prompt: {
|
||||||
start: 'What message shoudl i send?',
|
start: 'What message should i send?',
|
||||||
},
|
},
|
||||||
match: 'rest',
|
match: 'rest',
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,10 @@ class fakebotCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(message, args) {
|
async exec(message, args) {
|
||||||
if (!fs.existsSync(`./webhook/${message.guild.id}.json`)) {
|
if (fs.existsSync(`./webhook/${message.guild.id}_${message.channel.id}.json`)) {
|
||||||
message.channel.createWebhook('fakebot')
|
message.channel.createWebhook('fakebot')
|
||||||
.then(webhook => {
|
.then(webhook => {
|
||||||
fs.writeFile(`./webhook/${message.guild.id}.json`, `{"id": "${webhook.id}", "token": "${webhook.token}"}`, function (err) {
|
fs.writeFile(`./webhook/${message.guild.id}.json`, `{"id": "${webhook.id}", "token": "${webhook.token}", "channel": "${message.channel.id}"}`, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class fakebotCommand extends Command {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let webhook = reload(`../../webhook/${message.guild.id}.json`);
|
let webhook = reload(`./webhook/${message.guild.id}_${message.channel.id}.json`);
|
||||||
this.client.fetchWebhook(webhook.id, webhook.token)
|
this.client.fetchWebhook(webhook.id, webhook.token)
|
||||||
.then(webhook => {
|
.then(webhook => {
|
||||||
webhook.edit({
|
webhook.edit({
|
||||||
|
|
Loading…
Reference in a new issue