wendelstein7 / discordunitcorrector Goto Github PK
View Code? Open in Web Editor NEWA fully functional public Discord bot that automatically corrects non-SI units (imperial, etc) to SI-ones (metric, etc)
License: Other
A fully functional public Discord bot that automatically corrects non-SI units (imperial, etc) to SI-ones (metric, etc)
License: Other
While extremely large numbers (like the mass of the sun), are output in metric using scientific notation, inputs are not recognized as scientific notation and instead must be directly entered as a decimal.
This shows the method by which an input must be given in order to elicit a conversion. However, since no right-minded person would text the mass of the sun over Discord in such a way, we should expect never to make such a conversion. Instead, we should expect to find scientific notation.
Other similar forms exist and can (and perhaps should) be supported.
Three relatively significant errors exist in the definitions of the non-SI units that the bot will correct, when used. Specifically...
Cal
or Calories
should represent the food calorie (equivalent to the kilocalorie or 1000 calories). Lowercase cal
or calories
should represent the physical calorie (equivalent to the calorie or 0.001 kilocalories). The bot treats both capitalizations as lowercase.calories
and kilocalories
unit to a new Unit
subclass that allows case insensitivity (potentially moving some code to adhere to DRY without making classes backwards-incompatible), then update the matching regex for each unit.Unit
class structure may result in backwards incompatibility of the API. However, if this is deemed an unavoidable, necessary evil, it may be a good opportunity to reevaluate the flexibility of the rest of the existing class structure. That said, I think it is most likely that any changes used to solve this issue will leave us with a backwards-compatible version of the class structure, and that this will not be an issue.Some units that are relatively common or easy to implement can help contribute to the completeness of the bot and infrequency with which it misses conversions. I propose adding the cubic inch and cubic foot for a commonality that contributes to the infrequency with which conversions are missed, and I propose adding square and cubic versions of all distance units (where they are not yet implemented). I also propose adding the Reamur, Rommer, Newton, and Delisle temperature sytems.
When receiving a message such as
string 1 pound
, the bot will correctly correct it. However, the space between string
and 1
will be omitted as follows:
string454 g
.
I assume that this is a result of bad regex somewhere.
The cheap, scuffed fix would be to just add a space.
Another fix that depends on the user is to use 2 spaces.
Nonetheless, it is an inconvenience.
One thing that a lot of our imperial unit mebers dislike is the sass the bot has, rather than simply translating the unit into metric. It kind of does it in an unpleasant way with a sassy tone. I understand the bot is made to tease imperials but is there a way to turn off the sassy tone and rather simply get the unit conversion?
quoted from CuriousGeorge on Discord
This issue is being created because there is no way to turn off the sassy tone, but there could be.
|
or *
or ^
to the nicknameWhen the bot corrects a user in a server, the user is referred to by their user tag, not by their nickname. Given that it is more likely that a user is called by their nickname than their real name, the bot should also call users by that name.
message.author.name
to message.author.display_name
in DiscordUnitCorrector/unitbot.py
Line 43 in 8d57433
MPH converts to meters per second (m/s) instead of KPH
It makes more sense to convert to KPH instead of m/s
Currently, message I am 1 inch 3 feet.
corrects to I am 2.54 cm 0.914 m.
.
Rather, it would be favourable if it'd result in one combined SI unit: I am 0.93 m.
Different input prompts may find different amount of significant digits relevant. A measurement of whole feet typically doesn't need up to three significant digits. While 3 feet
gets corrected to 0.914 m
, perhaps 0.9 m
or 0.91 m
would suffice.
Perhaps the significance of the input could be taken into account: prompt 3.00 feet
or 12.54 stone
would result in more significant digits than 3 feet
and 12 stone
would.
1 US Liquid Pint = 0.832674 Imperial Pints
Imperial is stupid.
Can unitcorrector provide both types of pints when it detects someone talking about pints? In Britain, pubs serve drinks in Imperial pints, not US pints.
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.