codesupport / discord-bot Goto Github PK
View Code? Open in Web Editor NEWThe CodeSupport Discord Bot
Home Page: https://codesupport.dev/discord
License: MIT License
The CodeSupport Discord Bot
Home Page: https://codesupport.dev/discord
License: MIT License
It's not clear for newcomers how the bot is used - right now, the learning curve consists basically in watching other people use it. It would be nice if we had a ?commands
command that shows what are the available commands and what each one of them does.
The command should loop over all the commands, getting their names, descriptions and aliases (if there are any) and finally showing this data on an embed.
A help
alias would also fit nicely.
We should take advantage of the ability to colourise embeds depending on their status:
#35BC31
)#BC3131
)#1555B7
)These should be stored in the config.json
as:
{
"EMBED_COLOURS": {
"SUCCESS": "#35BC31",
"ERROR": "#BC3131",
"DEFAULT": "#1555B7"
}
}
Tests should also check the right embed colour is being sent if an embed and tested. Do not compare the value to the one in the config - these are not integration tests!
Usage: ?issues <username>/<repository>
As a: user
I want to: get a list of issues for a specific repository
So that I: can see them in Discord
This will require updating the GitHubService
so that it has a new method, getIssues()
, which returns an array of GitHubIssue
s (this will require a new interface).
When executing the command, an embed should be sent with the 3 most recent issues:
The bot still has code and NPM packages relating to the Twitter functionality which we used to have. This can all now be removed.
When a moderator deletes a message, no ghost ping message should be generated. Currently when a moderator removes a message, the ghost ping will trigger. Messages deleted by a mod generally get deleted with reason.
As a: Moderator
I want to: see message logs
So that: I can see if anything suspicious is being said
When a message is edited, it should be logged to the #logs
channel (ID: 405068878151024640
) with the previous content, new content and author:
This should be done inLogMessageUpdateHandler
.
When a message is deleted, logged to the #logs
channel (ID: 405068878151024640
) with the previous content and author. This should be done inLogMessageDeleteHandler
.
To run the bot in development we first have to transpile to JavaScript. It would be nice if we had a dev
script that used ts-node to transpile and run on the fly, such as "dev": "ts-node src/app.ts"
.
Commands should not be allowed to run in the #hiring-or-looking channel (ID: 328146607486795777
).
Currently, ghost pinging by deleting a message mentioning a bot (only bot or author + bot) is detected.
Deleting a reply (ping = on) to a bot is detected as well.
Is that the intended behavior? If not, I'd like to fix it.
As a moderator
I want to be able to see messages which are deleted in bulk
So that I can see what the Anti Spam Bot deleted
Event Trigger: messageDeleteBulk
For each message returned in the collection, an embed should be sent to the logs channel. This logic should be very similar the messageDelete
logic.
When guildMemberRemove
is triggered, an embed should be sent in the channel LOG_CHANNEL_ID
that sends an embed stating:
MEMBER_ROLE
if so)I am not sure if you can get the roles a user had from the quit event, so may need some investigation.
Just seems a wee bit odd that ?rule 1
is valid, but ?rule1
isn't
Please describe the functionality below:
Add a handler that allows users to only post in hiring-and-looking every x amount of days.
Please explain why this functionality would benefit our community below:
This will stop spam posts and it will also make life easier for the moderators.
Suggestion
Create a new role called "literate" (or anything you like) that will be given to users once they use the command ?hl. The only people able to send messages in #hiring-or-looking would be those with the "literate" role.
Since Discord has a limit of 50 pins per channel. I thought about making a custom pinning system where you'd be able to pin a message using it's ID, and a command to take a look at the pins, maybe giving the message link to "jump" to the message.
As a moderator
I want to be able to easily gather information about a user
So that I can fill out the member report form quicker
Command Usage: ?inspect <username | discord id>
Executeable by: Everyone
Executeable in: #bot-chat
Returns an embed with the following fields:
The embed colour should match the colour of their most senior role to be consistent with the quote embed.
The code wouldn't be that hard to add an optional param to the Issues command.
Design Questions:
Example syntax would be ?issues codesupport/discord-bot 37
Please describe the functionality below:
This PR will fix the changes described on here
this will not include the slash commands, buttons or select menu's
Please explain why this functionality would benefit our community below:
This will keep the bot up to date with the changes made to the discord api and discord.js library
Please describe the functionality below:
Feature to detect and respond to a limited scope of suspected advertisements.
Member
role.
Please explain why this functionality would benefit our community below:
There have been an increase in nitro advertisements being spammed in multiple channels. This feature will allow these messages to be quickly cleaned up and dealt with when moderators are not available, allowing them to add additional bans manually at a later point via the logged messages.
This should be similar to the SearchCommand and InstantAnswerService.
Create a GitHubService singleton (just base it on any of the other services) with method getRepository(user: string, repo: string)
that calls https://api.github.com/repos/<user>/<repository>
.
Command Usage: ?github <username>/<repository>
If a parameter is not supplied, return an error stating the correct usage (similar to the ?npm command). If a parameter is supplied, perform a GET request: if 200 is returned send an embed with the repository information as the repository is valid, if not state that a repository of the supplied name could not be found.
The embed should contain:
We could also add the number of forks and stars, but it might make the embed quite large.
A command to help users share the resources we recommend on the website.
Usage: ?resources <category>
The bot should then output https://codesupport.dev/resources?category=<category>
. Simple as that!
I suggest adding resource
as an alias for better usability.
Currently, when a user leaves the server with the muted role the muted role goes with them. They are able to rejoin and wreak havoc once again (like i did).
There should be a way so that the mute persists through kicking or the muted user leaving and rejoining.
Currently, bots also trigger the alert, this is unwanted behaviour.
Sometimes you want to trigger the codeblock command, so you enter codeblocks
. Nothing happens. Then you try codeblock
and it works. It would be nice if both codeblock
and codeblocks
triggered this command.
Get a link to an NPM package.
Command Usage: ?npm <package>
If a package is not supplied, return an error stating the correct usage (similar to the ?rule
command). If a package is supplied, perform a GET request: if 200 is returned send the link as the package is valid, if not state that a package of the supplied name could not be found.
This command should function identically to the one in the old Discord bot (see here).
Please describe the functionality below:
It will be a feature that will enable users to run code from many different languages in Discord itself, under a sandboxed API environment.
Please explain why this functionality would benefit our community below:
This feature will greatly help helpers as they would be able to run the problematic code and see the error or output in detail on the fly without opening a compiler. If output is long or it is an error it will be dmed so they can fix it efficiently. Very beneficial for small problems.
Creating an issue at the man's request:
A few months back, Lambo thought it was a good idea for a quick search to produce an embed for the relevant caniuse.com output, but it got forgotten about. This is just here as a reminder in case he finds the time or somebody else feels like chipping in (maybe I might try to get my act together).
verified members should be allowed to bypass the file upload filter. This is due to that verified members handle this more responsible over the average user.
If a Tweet contains a hashtag it currently comes through as a URL. Clicking on these URLs does not even take you to the right hashtag, so I'm not totally sure what's causing it. Anyway, we should just have the raw hashtags in the embed - I'm not too bothered about them being clickable.
Also, the tweet embed needs to be updated so that it has the default embed colour.
The LogMessageDeleteHandler
appears to be producing a UnhandledPromiseRejectionWarning
on line 21.
create a command that provides the following information
Some recommended resources to learn flexbox include:
• MDN - https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout
• Flexbox.io - https://flexbox.io/
• Flexbox Froggy - https://flexboxfroggy.com/ (Basic gamified tutorial)
• Flexbox Zombies - https://geddski.teachable.com/p/flexbox-zombies(More in depth gamified tutorial)
• https://css-tricks.com/snippets/css/a-guide-to-flexbox/
When you run the bot locally it produces a DiscordAPIError
stating that it has ”Missing Access”. This is due to it not being able to cache the authentication channel and message. We need to add a check so that this only happens when the NODE_ENV
is production.
Please describe the bug below:
Currently the bot spams general full with warnings, I have a solution for this problem, by adding in a queue_counter that only sends the message every x amount of dealt with queues
Please describe how you expect this functionality to work:
It should slow down and not send that message as often
Please describe how this functionality is actually working:
As I said, general now gets spammed multiple times back to back.
As a: Member
I want to: Be told to use a codeblock over a file upload
So that: People do not have to download my code
@AtrumAmantus suggested to me that it would be a good idea to detect file uploads and tell users to send their code as codeblock rather than a file upload.
I think the simplest way to do this would be by just allowing uploads of:
.jpg
.jpeg
.png
.gif
.mp4
If we detect they are uploading a file which does not match one of those extensions the bot should say:
@UserWhoUploadedTheFile Please use codeblocks over uploading code files. Type ?codeblock for more information.
The supported file extensions should be stored in the config.json
as an array of strings called SUPPORTED_FILE_UPLOADS
.
This should be done in CodeblocksOverFileUploadsHandler
.
We removed the Twitter service temporarily in #85 to fix a bug where the bot crashed on deployment.
We need this feature added back, but obviously do not want it to crash the bot.
Currently we're using npm i
to install dependencies on the CI automated tasks. We should be using npm ci
instead.
.github/workflows/main.yml
.github/workflows/coverage.yml
Currently, when someone retweets any tweet made by us it sends it in general with the prefix ”RT”.
This shouldn't happen as it gets quite spammy.
Although, it should still post any tweets that we retweet.
Problem: Currently the bot does detect when a reply was deleted that pinged the original message author, but the embed doesn't show that pinged user. Which would be useful information.
Solution: Add an if statement to check if the message was a reply, then add an extra field to the embed, that would look like:
Replied To:
@mention
Optional: Also show the content of the message that was replied to.
Currently an embed will still be generated if the message doesn't start with ! + Message link
Bug fix has to make it so ! Can be used anywhere in the message.
Also changing ! To <> to keep bot symbols consistent with discord.
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.