codewars / discord-bot Goto Github PK
View Code? Open in Web Editor NEWCodewars Discord Bot
License: MIT License
Codewars Discord Bot
License: MIT License
At the moment, the command performs the simple function of showing the user name and ID on the server. I find the command not so useful. Instead, we can create a function that will show a little info about the Codewars user.
The information includes: username, rank, honor, leaderboard position, number of katas created, number of katas completed.
As suggested on Discord, what if our bot had a command that could process basic natural language queries and maybe respond to them by quoting from the appropriate Codewars docs, and / or attempt to translate them into other standard commands? E.g. assuming my server nick matches my Codewars username, I could ask:
?ask How many 1 kyus do I need to complete to reach 2 dan?
30
Basically something similar to this assignment in an AI course, which doesn't seem too sophisticated, though perhaps a more complex approach is required for greater accuracy. Of course, there's also the question of whether such things are suitable in Node.js / TypeScript compared to Python.
What do you think?
Using the /echo
to output three backticks ``` with optional format freezes the browser tab.
To reproduce
Type /echo
, space, three backticks, tab and then click on the suggested additional format
option.
This will freeze the current browser tab and keep your CPU very busy. Only option then is to close the browser tab.
Tested with
When calculating a level to reach, or a user to beat, it would be nice if ?rankup
would have an option that takes your desired language into account, and additionally would support the option to select 'All' or 'My Languages'.
The ?rankup command added in recent times (thanks @Kacarott !) has gained massive popularity within the Codewars Discord server and is invoked very often. However, doing so sometimes drowns various topic channels with noise, detracting from whatever conversation was happening beforehand. As a result, a dedicated channel #bot-playground was created for the purpose of invoking this command (and possibly other future popular recreational commands), though moderators still have to constantly remind newcomers to move over to that channel for invoking the command.
Perhaps instead of manual moderation, the ?rankup command itself should only work in #bot-playground ? It would still be helpful to print an informative message in other channels though, so it doesn't give the false impression that the bot is broken or not responding.
The current message displayed when someone posts a link to the trainer is very short and concise, which minimizes the noise in the channel for all users. However, I think the bot is a bit too quiet, in that 99.9% of the time, the message from the bot is just ignored with no corrective action from the OP whatsoever (or even any indication that the OP noticed the bot at all).
This means that the trainer link is still there, often much more visible than the bot's message (especially with the link preview), making it very easy for other users (e.g. me) to accidentally click on the trainer link instead of the bot's corrected link, thus effectively rendering the bot's actions completely useless.
To fix this, maybe we should make the bot's message a reply to the OP or mention the OP, just so we can at least guarantee to catch the OP's attention? That way, it doesn't increase the noise for other users, but the OP is more likely to notice their error and hopefully more likely to take corrective action as suggested by the bot.
Currently the ?introduce command is only available to admin and mods but not power-users. Over time, this has proven to be an inconvenience as power-users may wish to tell newbies to format their code properly when asking Kata-related questions etc., but since the command is not available to them, they have to type the response manually. On the other hand, there are typically only 1 or 2 mods online at any given time and they may be too busy with other stuff to respond to newbies in a timely manner.
Since the ?introduce command is for informational purposes only, there is no reason to restrict its usage for power-users whom we expect to behave responsibly. We still do not want it to be available to any user though to prevent abuse. On the other hand, moderation tools such as ?warn should remain available only to admin and mods.
As seen in https://discord.com/channels/846624424199061524/846634002328715295/935805431660552212 and a few other places, newcomers to our server see our bot and expect to be able to summon a command like ?help
to obtain usage information on it, but get disappointed when there is no reply. I assume such a command is a convention commonly employed by other bots on Discord, so it would make sense for us to implement such a command as well so newcomers don't have to guess what the bot is able to do - the bot should tell us.
Currently, our official bot has some basic moderation features built in, but should we limit our bot to just moderation features? As an example, the Xena Project Discord server (public invite not available) has some 12 bots, where one of them (lean-bot
) is "homegrown" for running Lean code snippets, one of them (MEE6) is presumably used for moderation (though I've not seen it in action), but the other 10 are just bots "for fun", e.g. a counting
bot for playing a game of taking turns counting upwards, some 2 bots related to chess, etc.
If we decide to add some "game" features to our bot, here are a few ideas (that should not require connecting to the code runner):
Some possible pros:
Possible cons:
What do you think? Feel free to leave your opinions below.
At the moment there is no variety of roles on the codewars server as such. Now on the server there are roles only for administration. I would like to add roles for all users, as it is done on the site.
/verify key: "your key"
to the bot in private messages./roleup
.In the case of the /verify
command, it would be necessary to provide the bot with a key identifying the user. I think we need to create an individual key generator in the user's account settings on the site.
In the future, in case the user's rank is increased, we need to check this event in some way. I think that in order for the bot not to check in real time the change of rank, we should simply add a command /roleup
, which, using the previously obtained key, make a check of the user's account for its promotion.
When using ?rankup
, the bot calculates the number of Katas left to do, without taking the actual number of uncompleted Katas left for a user into account, which makes the bot's advice not very practical. This is especially true for the higher level Katas, as there are far fewer of them.
Please add this as a feature.
While the vast majority of Codewars users have welcomed Discord with open arms, there are still a tiny percentage of users who refuse to switch to Discord for various reasons such as privacy concerns or usability, etc. While that percentage is tiny, it includes some of the best known power users on Codewars such as @Voileexperiments and @JohanWiltink . Nevertheless, without a proper bridging mechanism between Discord and legacy Gitter, the community remains split into two with no reliable method of inter-communication.
In the past few weeks, @XRFXLP has managed to relay Discord messages to Gitter and vice-versa through the use of two separate bots. He concluded that it could not be reliably achieved with a single bot due to race issues(?). This experiment demonstrates that such a bridge is feasible to implement.
The question now is: do we consider it worth the time and effort to create such a bridge? If so, perhaps we can build the Discord to Gitter relaying with this existing bot and create a separate Gitter bot for the reverse direction. What do you think?
Likely caused by #45
When running npx plop command
or npx plop message-handler
, Plop no longer recognizes ".ts" as a valid file extension:
$ npx plop command
[PLOP] Something went wrong with reading your plop file TypeError: Unknown file extension ".ts" for /home/dsleung/discord-bot/plopfile.ts
at new NodeError (node:internal/errors:371:5)
at Object.file: (node:internal/modules/esm/get_format:72:15)
at defaultGetFormat (node:internal/modules/esm/get_format:85:38)
at defaultLoad (node:internal/modules/esm/load:13:42)
at ESMLoader.load (node:internal/modules/esm/loader:303:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:230:58)
at new ModuleJob (node:internal/modules/esm/module_job:63:26)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:244:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 0) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Currently, ?introduce @user #python
should error with a usage message since there is no help text for channel #python. However, the command silently fails instead which is undesirable.
Thanks @ejini6969 for triggering the bug.
Currently the default prefix for commands is ?
which isn't exactly widely used among Discord bots, but also not particularly unique. I think it would be better if our default prefix is more unique, like cw!
, to avoid clashing with prefixes used by other bots. Of course, our server does not currently intend to introduce bots other than our own CW Discord bot so there's not much practical motivation to change our prefix, but IMO doing so is still meaningful from a branding perspective. What do you think?
First mentioned in #36 (comment) , there are now concrete plans to migrate our bot to use slash commands in place of ad-hoc text-based commands in order to leverage features such as autocompletion, parameter and type checking; in fact, initial support for slash commands has been added in #41 , though the majority of text-based commands have yet to be migrated over.
This issue aims to list and keep track of the steps required to implement an incremental, smooth migration of our bot over to slash commands, minimizing impact on users in our Discord server. Feel free to suggest changes to the list below, and / or edit the list accordingly:
COMMAND_PREFIX
; update README accordingly/link
command; remove ?link
/introduce
command; remove ?introduce
/introduce
for unauthorized users/warn
command; remove ?warn
/rankup
command; remove ?rankup
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.