niles-bot / niles

Niles - a Discord bot for interfacing with Google Calendar

Home Page:http://nilesbot.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Delete Command issue

reedbird8 opened this issue · comments

I have tried copy and pasting the event name into the delete command. Also tried the format as follows: !delete day time

No matter what, I receive an error message "Couldn't find event with that name - make sure you use exactly what the event is named!"

!delete has the following restrictions

  • within date threshold
  • matches stored event summary
  • cannot match by date/time

relevant code

niles/handlers/commands.js

Lines 684 to 703 in db8ef87

function searchEventName(summary, guild, channel) {
// console log
console.log(`delete |${summary}|`);
listSingleEventsWithinDateRange(guild)
.then((resp) => {
console.log(typeof(resp.data));
if (!resp.data) return;
for (let curEvent of resp.data.items) {
console.log(`Summary |${curEvent.summary}|`);
if (curEvent.summary && summary.toLowerCase().trim() === curEvent.summary.toLowerCase().trim()) {
return curEvent;
}
}
}).catch((err) => {
log(`searchEventName | ${guild.id} | error ${err}`);
discordLog(err);
send(channel, i18n.t("deleteevent.error", {lng: guild.lng }));
});
//return false;
}

That still doesn't help me figure out why it's not working.

If I have an event that was created with the command:

!create Test Event on Sept 25 at 4PM EDT

that then gives me an event with the name/summary "Test Event", shouldn't I be able to delete it with the following command:

!delete Test Event

Sample image

image

trying with debug, there was an issue a lot time ago with having spaces but that was resolved a while ago

race condition, node isn't running it synchronously so I'll have to force an await

forcing await is returning the missing argument error, will probably have to wait for the rewrite

So, this means it likely won't work for the time being and manually delete will be required?