shotbow / chatbot Goto Github PK
View Code? Open in Web Editor NEWShotbow Discord Chat Bot
License: ISC License
Shotbow Discord Chat Bot
License: ISC License
In case we need to report to Discord Trust & Saftey, we should keep the message link so we can report it to them. Logging it in the #deleted-messages channel will help tremendously.
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)
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.
Reproduction steps:
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.
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
(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.```
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.
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.
Configuration:
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.
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
Create a github action that builds out an image that can be ran with configuration provided via ENV
/usr/lib/chatbot/src/Utility/DeletedMessage.js:13
message.guild.channels.find('id', this.config.deletedLogsRoom).send({
^
TypeError: Cannot read property 'channels' of null
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.
Acceptance Criteria
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.
Stretch goal #60
Acceptance Criteria
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.
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.
The following gamemodes are not yet on the configuration properly:
They need to be added in the aliases, names, rooms and forums categories.
Acceptance Criteria
.git
is no longer copied to the docker imageAcceptance Criteria
Notes
Acceptance Criteria
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.
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.
Line 89 in 07cbf1c
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.
I am working on a system to make Q&A sessions easier.
Features:
Room | ID |
---|---|
#annihilation | 228706232133746688 |
#death-by-void | 228706390883958784 |
#gg | 228706280951382016 |
#ghostcraft | 368735807345000449 |
#goldrush | 437370479658008576 |
#mine-theft-auto | 228706314233184256 |
#minez | 228706218351394816 |
#slaughter | 228706292913537027 |
#smash | 228706345807904768 |
Acceptance Criteria
!timeout 15 @Navarr#0001 Being a jerk
and Navarr#0001 will be muted for 15 minutesUpdate bot status to say "Playing on Shotbow with x others"
Update once per minute
Starboard code at: https://github.com/xDimGG/starboard
Search by UUID or MCID
Shows list of usernames attached to the name
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.
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."
[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]"
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.
Sometimes a support request may encompass more than one person, or someone from the staff team that is not part of the support team.
For those purposes, a !support invite <discord>
would be useful.
Similar to the internal /playercount tool. Show only games listed for searching
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.
Swipe requested this, should be relatively simple
As the title says. Might help with people constantly pinging all staff members if they need help because they think that's a good idea.
New configuration option: channel ID to send messages that have been deleted.
On message deletion, output who the poster was, what the message was, and who deleted it to the configured channel.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.