Giter VIP home page Giter VIP logo

chatbot's People

Contributors

dependabot[bot] avatar galapen avatar imsyphia avatar jamsheedmistri avatar mcjeffr avatar navarr avatar thomdemeulder avatar windex7 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

chatbot's Issues

Invalid Form Body content

events.js:171
    throw err; // Unhandled 'error' event
    ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
    at Client.emit (events.js:169:17)
    at WebSocketConnection.onError (/usr/lib/chatbot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)
    at WebSocket.onError (/usr/lib/chatbot/node_modules/ws/lib/event-target.js:128:16)
    at WebSocket.emit (events.js:180:13)
    at _receiver.cleanup (/usr/lib/chatbot/node_modules/ws/lib/websocket.js:211:14)
    at Receiver.cleanup (/usr/lib/chatbot/node_modules/ws/lib/receiver.js:557:13)
    at WebSocket.finalize (/usr/lib/chatbot/node_modules/ws/lib/websocket.js:206:20)
    at TLSSocket.emit (events.js:180:13)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at process._tickCallback (internal/process/next_tick.js:178:19)
Successfully logged in!
(node:1581) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
content: Must be 2000 or fewer in length.
    at item.request.gen.end (/usr/lib/chatbot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)
    at then (/usr/lib/chatbot/node_modules/snekfetch/src/index.js:215:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
(node:1581) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:1581) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1581) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
content: Must be 2000 or fewer in length.
    at item.request.gen.end (/usr/lib/chatbot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)
    at then (/usr/lib/chatbot/node_modules/snekfetch/src/index.js:215:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
(node:1581) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)

Unhandled Promise Rejection

5/30/2020 4:09:38 AM(node:30) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
5/30/2020 4:09:38 AM    at /usr/src/app/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65
5/30/2020 4:09:38 AM    at /usr/src/app/node_modules/snekfetch/src/index.js:215:21
5/30/2020 4:09:38 AM    at runMicrotasks (<anonymous>)
5/30/2020 4:09:38 AM    at processTicksAndRejections (internal/process/task_queues.js:97:5)
5/30/2020 4:09:38 AM(node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
5/30/2020 4:09:38 AM(node:30) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Bug: muted users can still execute commands, though their command message is deleted

Reproduction steps:

  1. Mute yourself / another user
  2. Execute any command / let a muted user execute any command
  3. ChatBot responds to the command and executes the command
  4. ChatBot sees that you / another user is muted and deletes your message

The reply of ChatBot is still in the channel. This means that you can indirectly spam a channel by spamming commands, even though you are muted.

Allow !support commands in DM

As an improvement, process !support commands in DM if the Discord user is a member of the Shotbow guild.

This would allow players to discreetly open a thread up with Shotbow staff, or open up support threads even if muted.

Use case: !support for reporting player abuses that require the attention of the Leadership

!mute fails if admin can't be DMed

(node:12159) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
    at item.request.gen.end (/usr/lib/chatbot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)
    at then (/usr/lib/chatbot/node_modules/snekfetch/src/index.js:215:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
(node:12159) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 17)
(node:12159) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Use a SSR graph to display historical player counts

Through means of Server-Side-Rendering, we could extend the functionality of !playercount (or create a new command) with a little graph that is generated using historical player counts to show the player counts over a longer timespan compared to just a timestamp with the current functionality.

For example: Example graph

Add reaction emoticons for !notifyme

During a weekly meeting, the suggestion to allow for clicking on a reaction emoji to add a notification role was brought up. These reactions could be to a message in a channel such as #welcome or just a new channel.

The idea here is that ChatBot (or an admin) will post a message in a channel, and that message ID is then stored in the configs. ChatBot can then automatically add the reactions for each of the roles (as defined in config). You can then add a utility that listens to reaction add events, do the checks and grant the roles (or revoke them, if the user already has that role).

We can approach this in two ways: one message with many reactions added to it for each game, or one message per !notifyme entry that ChatBot keeps in sync with the configuration. See the two attached screenshots for how each of the two could look respectively.


Support System

Configuration:

  • "Support Channels" category
  • "Support Staff" rank id
  • Map of command name to rank id
    e.g. "!minezSupport" -> "MineZ Support"

When a user types a command in this list, it creates a random identifier (to be called [rand]). And then creates a new channel support-[rand] in the category, and a new role support-[rand]. The new channel does not allow anyone to read send or read history, and allows both support-[rand] and the role for the command to read and send messages.

When a user with the "Support Staff" role types !close in one of these channels, it deletes the channel and role.

!time command

Shows the current time in US Central / GMT / JST

Stretch goal:
Takes one parameter, a date-time string, converts it to unix format, and outputs that time in US Central / GMT / JST

Feature: Overhauled presence using Rich Presence

Back when we wrote the initial version of the "Playing on Shotbow with x others", the Rich Presence API didn't really exist yet. Nowadays, we do have it, luckily!

We should look at implementing the Rich Presence API nicely for Chat Bot. This means displaying the current information about the amount of players online, but also maybe something like the server IP or website. Though Rich Presence is mainly for games, and there is an SDK for Discord, we don't necessarily need this. IDEs such as IntelliJ or VS Code also implement it.

More information here: https://discord.com/developers/docs/rich-presence/how-to and on the Application page for Chat Bot.

element.delete is not a function

ChatBot is spamming the following message: element.delete is not a function. This is most likely caused by a bug in the Command.js file, in the deleteMessage function. A small rewrite of this function to add more safety checks, as well as the issue with message in the for-loop that isn't being used is recommended.

Will pick this up later.

Dockerize

  • Add a Dockerfile that runs npm as part of the docker build and runs the server as part of the docker run
  • Move configuration to ENV so it can be set through docker/rancher

Stretch goal #60

Support System Auto-Close

Acceptance Criteria

  • After 2 days of no messages, Chat Bot should warn a channel that it will be automatically closed.
    • If the last message sent in the chatroom after 2 days have passed is chat bot's warning to close, Chat Bot should automatically close the support room.

Suggested Technical Implementation

Chat Bot should run a job hourly in which it checks through all the support chatrooms to see if the last message in that room is over 24*3 hours old. If so, and the last message is from Chat Bot, the room should be automatically closed. Otherwise, if the message is not from chat bot (and still meets the age requirement), Chat Bot should post a warning that the room will be automatically closed in 3 days.

Allow support room categories to not auto-close

This has been an issue with especially support tickets on bugs. We might want to have the option to configure the auto-close timer on each category rather than on all categories at once.

Add missing gamemodes to configuration

The following gamemodes are not yet on the configuration properly:

  • Miner Problems
  • Wasted
  • Warband

They need to be added in the aliases, names, rooms and forums categories.

Permanent Mutes

Acceptance Criteria

  • When a user is muted, leaves the server, and later rejoins the server, the mute persists.
  • Such a mute persists even if the bot script restarts

Technical Notes

I thought this would require a database, but I suppose it shouldn't. This functionality could be possible by keeping a map of DiscordIDs (to boolean true, for quick lookup) of muted users in memory. When the bot starts, it could find all users with the role and add them to the array (and then update the array throughout the !mute and !unmute commands). This would allow persistence without necessitating an external data layer.

Update discord.js to version 12

Discord is changing their domain from discordapp.com to discord.com. They will do this on November 7th, we must ensure that we have updated Discord.js prior to that date otherwise it will stop working.

Discord.js have already updated the domains, but have yet to roll a release of these changes. As soon as they do, we should update to the latest version of Discord.js.

npm defined as a dependency

It seems that in the list of dependencies, npm is also installed as a dependency. I don't think that npm should be a dependency as it should be installed by default on any device that runs node.js. However, since npm is packaged as well, the node_modules directory is excessively large.

This dependency seems to have slipped in at 83bb3c5.

Q&A System

I am working on a system to make Q&A sessions easier.

Features:

  • !start & !stop
  • Queue of people to ask questions
  • !next to advance the queue and unmute a person so they can take the floor

Update !playercount to automatically select the game in a Chat Room

Room ID
#annihilation 228706232133746688
#death-by-void 228706390883958784
#gg 228706280951382016
#ghostcraft 368735807345000449
#goldrush 437370479658008576
#mine-theft-auto 228706314233184256
#minez 228706218351394816
#slaughter 228706292913537027
#smash 228706345807904768

Add !timeout command

Acceptance Criteria

  • I can type !timeout 15 @Navarr#0001 Being a jerk and Navarr#0001 will be muted for 15 minutes
  • 5 minutes after such a command is typed, I restart the bot. 15 minutes after such a command, Navarr#001 is unmuted.
  • For the time, I can specify multiple numbers and letters in one string: (3d2h5m)
    • m - Minutes
    • h - Hours
    • d - Days
  • If a user is timed out that is already muted, I am messaged a warning that I cannot time them out b/c they are already muted
  • If a user is already timed out and I type the command, the new timeout overrides the old one, and I see a message saying how long they had left on their previous timeout and how long they have left on their new one

Unused and duplicate dependency "discordClient" in Playercount.js

In the Playercount.js command, the dependency "discordClient" is defined. This dependency is not used in this class. Furthermore, Playercount.js extends Command.js, which extends BotModule.js. In BotModule.js, the "discordClient" dependency is already declared as well.

As a banned player, I would like the ability to appeal my ban through Chat Bot

User should have the ability to start a ban appeal (in Private Chat only)

!appeal start

In guild, informs the player that they can appeal by private messaging the bot the same command

In DM, Informs the player of what to type in their appeal, and then starts recording all messages typed as part of the appeal. Bot adds \n\n between messages.

Stretch Goal: deleted messages in DM should be deleted from the appeal.

cancel (or !appeal cancel or !appeal stop)

'Are you sure? All your messages will be erased. (Please type "Yes" or "No")'

(Yes/Y): "OK, Your appeal has been cancelled." (clears data from memory)
(No/N): "OK, Please continue where you left off." (with stretch: "You can still delete lines from your appeal by deleting the private message they were added with")

"Done" / !appeal done / !appeal send

'Here is your current appeal, please read over it and confirm it is ready:

Would you like to send? Y/N:"

Same ol' yes/no prompt.

(Yes/Y): "OK, I have sent your appeal." (sends appeal to a configured channel and clears out the data)
(No/N): "OK, Please continue where you left off."

In configured appeal channel

[message appears] (From: Discord Player [discordId])

!appeal accept [discordId]

DM's discord user: "Your appeal has been accepted and you have been unbanned. Thank you for flying Shotbow"

!appeal reject [discordId] [reason]

DM's discord user: "Your appeal has been rejected. The staffer handling the appeal said: [stuff]"

Make support messages configurable per type

Right now, there is only one template that is used for the info message posted by ChatBot in a support channel. However, this template is not very applicable to some categories like bugs. Having these messages changeable per support type would help with providing better information to the user who needs support.

Add a !forums command

User Story 1: "As a user, I want to be able to type !forums in any non-gamemode channel to be linked to the forums so that I can browse through them."
User Story 2: "As a user, I want to be able to type !forums in a gamemode specific channel to be linked to the forums of that gamemode, so that I can read through the forums of this specific gamemode."

This might be a useful command as it can help in situations where the forums of a specific game need to be linked for someone to direct to, e.g. for placing suggestions or getting help. It would work somewhat similar to how !playercount responds to each gamemode specific channel.

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.