Giter Site home page Giter Site logo

niles-bot / niles Goto Github PK

View Code? Open in Web Editor NEW
61.0 61.0 21.0 2.17 MB

Niles - a Discord bot for interfacing with Google Calendar

Home Page: http://nilesbot.com

License: MIT License

JavaScript 99.87% Dockerfile 0.13%
bot calendar discord discord-bot google-calendar

niles's People

Contributors

dependabot[bot] avatar docvalerian avatar engise avatar flufftronix avatar lyuwen avatar majorarkwolf avatar mchangrh avatar seanecoffey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

niles's Issues

admin crashes Niles

when responding to the y/n query of "Do you want to restrict the use of the calendar to people with the"...

Niles crashes, throwing a Promise Rejection: undefined with error code undefined

Anyone can add to the calendar

There really should be some restrictions so not just anybody can add to the calendar .

if there is I'm not finding it other than changing the prefix to something cryptic

Fix count when !clean is used and kills a timer

function clean(channel, numberMessages, recurse) { ....

messages.forEach(function(message) {
if(message.id === calendar["calendarMessageId"]) {
calendar["calendarMessageId"] = "";
helpers.writeGuildSpecific(channel.guild.id, calendar, "calendar");
clearInterval(autoUpdater[channel.guild.id]);

            **timerCount[message.guild.id] -= 1;**

tz offset with calendar

Supposed to display GMT-4 and my calendar is written in GMT-6 but instead of 2 hours ahead, it's displaying 4 hours behind

somewhere, zone is not being parsed?

All Day Events showing 1 day longer than they should

When putting in all day events, the event bleeds over to the following day.,

Suggested fix:

Line 163 of commands.js

let lengthEvent = ((tempEndDate.getTime() - tempStartDate.getTime()) / (1000 * 60 * 60 * 24));
to
let lengthEvent = ((tempEndDate.getTime() - tempStartDate.getTime()-1) / (1000 * 60 * 60 * 24));

This, in theory, should set the length of the event to one second less, which should be enough to keep from bleeding over

Alternately, like 163 remains the same, and line 167 changes from

for (let x = 1; x <= lengthEvent; x++) { //Add New Entry For Each Day of A Multi Day Event

to

for (let x = 1; x < lengthEvent; x++) { //Add New Entry For Each Day of A Multi Day Event

crash when richEmbed exceeds 2048 characters.

uncaughtException errorRangeError: RichEmbed descriptions may not exceed 2048 characters.

Implement test for character size and provide recommendations to user to minimise embed size.

Node v12 Crashes

ever since #39 the bot has been crashing constantly after:

ENOENT and then uncaughtException

Changes; Discord v12 & Node.js 8 -> Node.js 12

Allow for named timezones

Currently the !tz command only allows a numerical entry, ie: GMT-07:00. However, this doesn't take into account things such as daylight savings.

Please allow the !tz command to use named timezones, such as America/Los_Angeles, which will automatically account for daylight savings.

Further, also display the timezone somewhere in !display.

Multiple-day events only show as being on the first day

My name is melt7777 and I work with the PiMP Testing/Support Team. We have filed this issue based on our testing of your Niles Discord Bot. Thank you very much for your work toward our mutual goal of making easy and effective tools for Discord moderators and administrators. We are bringing this issue to light because it is affecting our use of your product and we need your help.

This issue is to report that multiple-day events are not displayed correctly in the Discord. They show as only the first day. We tried "All-day" and with time defined on start and stop day. Filing separate issue for "undefined" as it should be something more user friendly there.

We added a multiple-day Event called "Doc vaca" from Nov 5 to 9th

Calendar screenshot:
image

Screenshot of Niles in our Discord channel:

image

Thank you again for your software!
~ melt7777
getpimp.org | miner.farm

!help improvements

!help should be in the channel and include basic commands for the general user

!adminhelp should be in a PM and for admin commands ie !purge

Just a thought

Need ability to "confirm" event

Enhancement request

First and foremost, i love this bot, it so simple.

I'd like to add a layer of sophistication to it to where if i create an event, members of the Discord can confirm going to it.

For example, if I create a RAID event !create RAID Saturday 10am -2pm , members of the discord should be able to do something like !confirm RAID DeFlanko Saturday 10am
!confirm <Subject> <Gamertag> <Date>

That info could reside inside the comments of the Event.

Even fancier, if possible, set a need count too like !need 6 Saturday 10am so this way in the comments it will show 6/6 at first, but everytime someone confirms to it the count number changes by one till 0

for Example:
2019-07-29_23-20-11

All day events show as "undefined - undefined" on the calendar display

My name is melt7777 and I work with the PiMP Testing/Support Team. We have filed this issue based on our testing of your Niles Discord Bot. Thank you very much for your work toward our mutual goal of making easy and effective tools for Discord moderators and administrators. We are bringing this issue to light because it is affecting our use of your product and we need your help.

This issue is to report a bug/enhancement: when "All Day" was selected (no start/stop times were defined for the event), it showed as "undefined - undefined" in the time frame, which is confusing to the end user. We would humbly request that something else be displayed here, such as "All Day".

Thank you again for your great work!
~ melt7777
getpimp.org | miner.farm

Re-Creating existing guilds

Niles is recreating a lot of new guilds on startup, We need a simple file check to see if the guild already exists

Use inline fields

Examples Submitted by user

unknown (1)
unknown (2)
unknown

embed:

{
    "thumbnail":{
        "url":"https:\/\/assets.url.tld\/silph-arena\/assets\/2020-03-01-regionals\/regionals-2020-crest.png",
        "proxy_url":"https:\/\/images-ext-2.discordapp.net\/external\/AL2amu4gl1KzPyNcbwTZ12_nYFeAnYsBp-V8_2s36FQ\/https\/assets.url.tld\/silph-arena\/assets\/2020-03-01-regionals\/regionals-2020-crest.png",
        "width":400,
        "height":400
    },
    "author":{
        "name":"Arkansas PvP",
        "url":"https:\/\/silph.gg\/tournaments\/results\/myhf",
        "icon_url":"https:\/\/assets.url.tld\/silph-arena\/assets\/silph-arena-logo\/logo-transparent-white.png",
        "proxy_icon_url":"https:\/\/images-ext-2.discordapp.net\/external\/S5qW7u13zeXcsWFBod1oYR-Dt72yDcwnJ2DU06o1Twg\/https\/assets.url.tld\/silph-arena\/assets\/silph-arena-logo\/logo-transparent-white.png"
    },
    "fields":[
        {
            "name":"**__Points__** **__Trainer__**",
            "value":"`8` [username](https:\/\/url.tld\/username)\n`7` [username](https:\/\/url.tld\/username)\n`6` [username](https:\/\/url.tld\/username)\n`6` [username](https:\/\/url.tld\/username)\n`5` [username](https:\/\/url.tld\/Madimausernamedeme)\n`4` [username](https:\/\/url.tld\/username)\n`4` [username](https:\/\/url.tld\/username)\n`4` [username](https:\/\/url.tld\/username)\n`4` [username](https:\/\/url.tld\/username)\n`4` [LyonsDen716](https:\/\/url.tld\/LyonsDen716)\n`4` [username](https:\/\/url.tld\/username)\n`4` [username](https:\/\/url.tld\/username)",
            "inline":true
        },
        {
            "name":"**__Points__** **__Trainer__**",
            "value":"> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> ` ` [username](https:\/\/url.tld\/username)\n> `3` [dakeeler](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/SirMillzy)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)\n> `3` [username](https:\/\/url.tld\/username)",
            "inline":true
        },
        {
            "name":"**__Points__** **__Trainer__**",
            "value":"> `2` [username](https:\/\/url.tld\/username)\n> `2` [username](https:\/\/url.tld\/username)\n> `2` [username](https:\/\/url.tld\/username)\n> `2` [username](https:\/\/url.tld\/username)\n> `2` [username](https:\/\/url.tld\/username)\n> `2` [username](https:\/\/url.tld\/username)\n> `2` [username](https:\/\/url.tld\/username)\n> `2` [username](https:\/\/url.tld\/username)\n> ` ` [username](https:\/\/url.tld\/username)\n> `2` [username](https:\/\/url.tld\/username)\n> `1` [username](https:\/\/url.tld\/username)\n> `1` [username](https:\/\/url.tld\/username)\n> `0` [KIlgoure](https:\/\/url.tld\/username)",
            "inline":true
        }
    ],
    "color":16098851,
    "timestamp":"2020-04-19T17:00:00+00:00",
    "type":"rich",
    "description":"> __**[Silph Arena Regional](https:\/\/url.td\/2020-regional-invitationals-competitor-info)**__ \nArkansas was chosen to host this season's regional tournament. The top two will go on to Go Fest to represent our region at the Continental Championship. There were 42 participants overall and a large portion from our state. \n\nWhile Cabot Pokemon Go and Conway Pokemon Speakeasy hosted, it was all done by the awesome folks running [ARPVP](https:\/\/silph.gg\/c\/74403ec5\/leaderboard). In the wake of the covid19 pandemic the ARPVP Squirtle Squad adapted and organized what I consider the highest honor our state has had with Silph Arena. Hopefully this is the first of many Arkansas regionals to come. Thank you Squirtle Squad for everything you do for our states success.\n\nThe path to the Championships has started but the Silph Arena Season continues. Expect more Speakeasy Silph Cups to be scheduled soon.\n\n**__Results__**",
    "url":"https:\/\/url.td\/tournaments\/results\/code",
    "title":"2020 Regional Invitationals: Arkansas"
}

create notification system

potential options:
digest some time before, i.e. <list of events> starting in x hours.

alternative / "standard", event starting in x hours / mins.

Changing Calendar ID doesn't kill old update timer.

After changing calendarID, keeps re-writing old events (probably pulling from the old JSON file in memory the old "timer" ?).

Need to add clearInterval. More likely an indicator that everything really needs to be moved to an SQL database.

ReferenceError: params is not defined

I am getting the following errors, when trying to "!display" the calendar. I tried with NodeJS v12 and v14

[Thu, 06 Aug 2020 16:55:16 GMT] Error in function getEvents in guild: xxxxxx : ReferenceError: params is not defined
[Thu, 06 Aug 2020 16:55:17 GMT] Promise Rejection: DiscordAPIError: Cannot send an empty message

Am I missing something?

update timer restart

"It might be easier to just do like a clear all, then upon restart, it queues all the servers up and slowly starts to update them. That way it doesn't then get recaught on something. I don't know how feasible that is, as it probably depends on how many different discords the bot is in.
If the killed message never displayed, no one would know. Then they would just manually update anyway hehe"

Missing Events

Hey there, glad to see Niles is back! But a bug that existed before is still happening to me: I often will get missing events from my schedule.

Take this calendar:
image

This is the output after !display and !update:
image

Any idea what's going on here? The Wednesday and Thursday events are the missing events.

TLS AbortError

Log Preview

[Thu, 10 Sep 2020 21:16:35 GMT] USER#0000:!create ... || guild:XXXXXXXXXXXXXXXXXX || shard:1 
 [Thu, 10 Sep 2020 21:18:03 GMT] error reading file SyntaxError: Unexpected end of JSON input 
 [Thu, 10 Sep 2020 21:18:20 GMT] error reading file SyntaxError: Unexpected end of JSON input 
 [Thu, 10 Sep 2020 21:19:49 GMT] error reading file SyntaxError: Unexpected end of JSON input 
 [Thu, 10 Sep 2020 21:19:52 GMT] error reading file SyntaxError: Unexpected end of JSON input 
 [Thu, 10 Sep 2020 21:19:57 GMT] Promise Rejection: TypeError: m.edit is not a function 
 [Thu, 10 Sep 2020 21:21:30 GMT] error reading file SyntaxError: Unexpected end of JSON input 
 [Thu, 10 Sep 2020 21:21:35 GMT] Promise Rejection: AbortError: The user aborted a request. 
 [Thu, 10 Sep 2020 21:23:37 GMT] function getEvents error in guild: XXXXXXXXXXXXXXXXXX : Error: {"origin":"Events.list","error":"Client network socket disconnected before secure TLS connection was established"} 
 [Thu, 10 Sep 2020 21:30:10 GMT] function getEvents error in guild: XXXXXXXXXXXXXXXXXX : Error: {"origin":"Events.list","error":"Client network socket disconnected before secure TLS connection was established"} 
 [Thu, 10 Sep 2020 21:21:36 GMT] function getEvents error in guild: XXXXXXXXXXXXXXXXXX : Error: {"origin":"Events.list","error":"Client network socket disconnected before secure TLS connection was established"} 
 [Thu, 10 Sep 2020 21:30:42 GMT] Promise Rejection: AbortError: The user aborted a request. 
 [Thu, 10 Sep 2020 21:21:36 GMT] function getEvents error in guild: XXXXXXXXXXXXXXXXXX : Error: {"origin":"Events.list","error":"Client network socket disconnected before secure TLS connection was established"} 
  • Catch AbortError and verbosely print system information for debug
  • figure out why TLS sockets are being dropped

Sharding required - guild limit

we have hit the discord limit of guild per session

Changes needed

  • methods to make databases for missing guilds
    • methods to be able to fetch
    • launch when shards all ready
  • shared i/o
  • not all shards can access log channel
  • commands only working on last shard

Irrelevant Changes

  • increased memory use
  • DM Collector
  • guildCreate triggers as bot is starting up
  • guildDelete triggers as they are moved btw shards doc

use Moment.js for date parsing

in order to help fix #37 - why do something yourself when someone else does it better?

This allows for easier parsing of dates, since moment.js is already installed and used for !stats

  • moment.js for convertDate
  • moment.js tz for Timezone parsing
  • proper implementation for multi-day events
  • 12 hour/ 24 hour parser

confusing !admin documentation

Current Output:
!admin - Restrict usage to a specific role, i.e. “Scheduler” or “Captain”. Role must be assigned to yourself before using command.

Proposed:
Cannot find "role". Role assign is case sensitive. Please be sure to assign the role to yourself before setting it as the admin role.

"i think what you guys got works great, maybe just adding that extra line just so people know the role needs to be assigned to themselves first"

Need to handle permission errors

Occurs when has read but not write permissions in a certain channel.
Possibly send a message to the user or in #general that the full permissions have not been granted.

Basic setup improvements

1. Invite [email protected] to 'manage events' on the Google Calendar you want to use with Niles

Change manage events to 'make changes and manage events'

Enter a calendar ID using !id, i.e. !id [email protected]

Change the example to the same url in !setup so it doesn't look like an email.

something went wrong

When entering !tz with nothing after it. Explain the error ie. Enter the timezone you want to use in Discord with the !tz command, i.e. !tz gmt+10:00, (Note: Must be formatted like this)

!ping crashes bot

error running main message handler in guild: XXXX: TypeError: Cannot read property '0' of undefined

Date Format for creation

Hey,
really appreciate the Bot so far, a little feature would make it a lot more usable for me:
Choose your Date Format, since I'm from Germany I would write 04.05.2020 for today but the bot needs 05.04.2020 which is quite confusing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.