Update commands to use message.reply, rather than promises
The promise method was just too annoying, better to go back to .reply
This commit is contained in:
parent
dc889096a5
commit
b682b8af5c
|
@ -29,7 +29,6 @@ function invoke({ message, params, guildData, client }) {
|
|||
maxCacheSize: Config.maxCacheSize
|
||||
});
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
//ask the user if they're happy with the details they set up, save if yes, don't if no
|
||||
Core.util.ask(client, message.channel, message.member, "Are you happy with this (yes/no)?\n" + feedData.toString())
|
||||
.then(responseMessage => {
|
||||
|
@ -41,10 +40,9 @@ function invoke({ message, params, guildData, client }) {
|
|||
|
||||
guildData.feeds.push(feedData);
|
||||
guildData.cachePastPostedLinks(message.guild)
|
||||
.then(() => resolve("Your new feed has been saved!"));
|
||||
.then(() => message.reply("Your new feed has been saved!"));
|
||||
}
|
||||
else
|
||||
reject("Your feed has not been saved, please add it again with the correct details");
|
||||
});
|
||||
message.reply("Your feed has not been saved, please add it again with the correct details");
|
||||
});
|
||||
}
|
|
@ -11,8 +11,8 @@ module.exports = new Core.Command({
|
|||
function invoke({ message, params, guildData, client }) {
|
||||
const idx = guildData.feeds.findIndex(feed => feed.id === params[2]);
|
||||
if (!Number.isInteger(idx))
|
||||
return Promise.reject("Can't find feed with id " + params[2]);
|
||||
message.reply("Can't find feed with id " + params[2]);
|
||||
|
||||
guildData.feeds.splice(idx, 1);
|
||||
return Promise.resolve("Feed removed!");
|
||||
message.reply("Feed removed!");
|
||||
}
|
|
@ -10,7 +10,7 @@ module.exports = new Core.Command({
|
|||
|
||||
function invoke({ message, params, guildData, client }) {
|
||||
if (!guildData)
|
||||
return Promise.reject("Guild not setup");
|
||||
message.reply("Guild not setup");
|
||||
|
||||
return Promise.resolve(guildData.feeds.map(f => f.toString()).join("\n"));
|
||||
message.reply(guildData.feeds.map(f => f.toString()).join("\n"));
|
||||
}
|
|
@ -13,13 +13,14 @@ client.on("beforeLogin", () => {
|
|||
setInterval(() => checkFeedsInGuilds(client.guilds, client.guildsData), Config.feedCheckIntervalSec * 1000);
|
||||
});
|
||||
|
||||
client.on("ready", (coreClient) => {
|
||||
parseLinksInGuilds(coreClient.actual.guilds, coreClient.guildsData)
|
||||
.then(() => checkFeedsInGuilds(coreClient.actual.guilds, coreClient.guildsData));
|
||||
client.on("ready", () => {
|
||||
parseLinksInGuilds(client.guilds, client.guildsData)
|
||||
.then(() => checkFeedsInGuilds(client.guilds, client.guildsData));
|
||||
});
|
||||
|
||||
client.on("message", message => {
|
||||
const guildData = client.guildsData[message.guild.id];
|
||||
if (guildData)
|
||||
guildData.feeds.forEach(feedData => {
|
||||
if (message.channel.name === feedData.channelName)
|
||||
feedData.cachedLinks.push(...GetUrls(message.content));
|
||||
|
|
Loading…
Reference in a new issue