Skip to content

Commit

Permalink
Merge pull request #6 from MindfulMinun/dev
Browse files Browse the repository at this point in the history
Release v3.0.0
  • Loading branch information
MindfulMinun authored Aug 3, 2019
2 parents 6cc559b + b54c93f commit c5532d7
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 41 deletions.
51 changes: 46 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,56 @@
X should be incremented if there are major changes or major backwards incompatibilities
Y should be incremented if new backwards-compatible changes are made.
Z should be incremented if backwards-compatible bug fixes are implemented.
See https://semver.org/lang/es/
See https://semver.org/
-->

# [Release v3.0.0](https://github.com/MindfulMinun/discord-haruka/releases/tag/v3.0.0)
**Note:** The three probably doesn't mean anything to you.

### Additions & Changes
- New: WolframAlpha
- Query the world's information with Haruka's `-h wa` function!
- Smash
- Now denotes whether a character is DLC or not.
- Updated help data
- Added Hero and Banjo-Kazooie metadata.
- Ping
- Now shows 3 numbers, WebSocket ping, Reaction time, and Delivery. This may be more confusing but I digress.
- Dev
- Added `fetch` helper function
- Switching from `config.json` to `.env`
- This is a breaking change, which constitutes bumping the major version number.

### Bug fixes
- Help
- Help would refuse to show the detailed help list when asked to. I'm still not sure why, but this has been fixed.
- Smash
- Smash uses the FrannHammer API for determining whether frame data was available. [The endpoint has since changed](https://github.com/Frannsoft/FrannHammer/wiki/v0.7.0-Update).

-----

# Development version v3.0.0
**Note:** The three probably doesn't mean anything to you.
- Switching from `config.json` to `.env`
- Added `fetch` helper function
- Added Hero and Banjo-Kazooie to Smash
- Added WolframAlpha function

### Additions & Changes
- New: WolframAlpha
- Query the world's information with Haruka's `-h wa` function!
- Smash
- Now denotes whether a character is DLC or not.
- Updated help data
- Added Hero and Banjo-Kazooie metadata.
- Ping
- Now shows 3 numbers, WebSocket ping, Reaction time, and Delivery. This may be more confusing but I digress.
- Dev
- Added `fetch` helper function
- Switching from `config.json` to `.env`
- This is a breaking change, which constitutes bumping the major version number.

### Bug fixes
- Help
- Help would refuse to show the detailed help list when asked to. I'm still not sure why, but this has been fixed.
- Smash
- Smash uses the FrannHammer API for determining whether frame data was available. [The endpoint has since changed](https://github.com/Frannsoft/FrannHammer/wiki/v0.7.0-Update), breaking older versions of Haruka's Smash function.

-----

Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: npm start
13 changes: 6 additions & 7 deletions dist/functions/help.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions dist/functions/ping.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions dist/functions/smash.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/functions/wa.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discord-haruka",
"version": "2.1.1",
"version": "3.0.0",
"description": "A useless Discord bot.",
"main": "dist/Haruka.js",
"repository": "github:MindfulMinun/discord-haruka",
Expand Down
14 changes: 8 additions & 6 deletions src/functions/help.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#! Help
handler = (msg, match, H) ->

helpforCommand = match?[1]?
if helpforCommand?
tokens = match.input.tokenize()

if /^(?:help|h)/i.test tokens[0]
for fn in H.functions
helpMatch = fn.regex.test helpforCommand
if helpMatch then return msg.channel.send fn.help.long
if fn.regex.test tokens[1]
return msg.channel.send fn.help.long

allHelpList = """
Here’s a list of all my commands. Arguments in `<angle brackets>` \
Expand All @@ -27,7 +28,7 @@ handler = (msg, match, H) ->

module.exports = {
name: "Help"
regex: /^(?:(?:\s*$)|(?:(?:help|h)(?:\s+(\S[\s\S]*))?))/i
regex: /(?:^(?:help|h)(\s+|$))|(?:^\s*$)/i
handler: handler
help:
short: "-h help [...] ::
Expand All @@ -37,7 +38,8 @@ module.exports = {
=== Help for Help (so meta) ===
*Aliases*: help, h
-h help :: Returns a help menu listing all the commands.
-h help [command] :: Returns a help menu for that specific command.
-h help [command] :: Returns a help menu for that specific
command, much like this one.
```
"""
}
22 changes: 17 additions & 5 deletions src/functions/ping.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ handler = (msg, match, Haruka) ->
when "owo" then msg.reply "uwu"
else msg.reply "Pong!"
).then (reply) ->
p = Haruka.client.ping
delta = reply.createdTimestamp - msg.createdTimestamp
reply.edit("#{reply.content} (#{delta}ms)")
reply.edit(
"#{reply.content} (WebSocket: #{p}ms,
Reaction: #{delta}ms,
Delivery: #{delta - p}ms)"
)

module.exports = {
name: "Ping"
Expand All @@ -28,10 +33,17 @@ module.exports = {
*Aliases*: ping, beep, ding, owo, uwu, awoo
-h ping :: Replies "Pong!" along with the time it took to reply.
-h beep :: Replies "Boop!" along with the time it took to reply.
-h ding :: Replies "Dong!" along with the time it took to reply.
-h uwu :: Replies "OwO" along with the time it took to reply.
-h owo :: Replies "uwu" along with the time it took to reply.
-h awoo :: Replies "Awoo!" along with the time it took to reply.
-h ding :: Replies "Dong!"...
-h uwu :: Replies "OwO"...
-h owo :: Replies "uwu"...
-h awoo :: Replies "Awoo!"...
*Note(s):*
The WebSocket time is the mean of the last 3 heartbeat
pings of Haruka's WebSocket.
The Reaction time is raw difference between you sending the
command and Haruka repling to it.
The Delivery time is Haruka's Reaction time minus
internal evaluation time.
```
"""
}
16 changes: 12 additions & 4 deletions src/functions/smash.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fNameMap = [
]

root = 'https://www.smashbros.com/assets_v2'
frameDataURL = 'https://test-khapi.frannsoft.com/api/characters/?game=ultimate'
frameDataURL = 'https://api.kuroganehammer.com/api/characters/?game=ultimate'
fighterPath = root + '/data/fighter.json'


Expand All @@ -134,7 +134,8 @@ handler = (msg, match, Haruka) ->

if not args
return msg.reply [
"You didn’t enter a search term, so I couldn’t search for a fighter."
"You didn’t enter a search term, so I couldn’t
search for a fighter."
"You need to enter a search term to search a fighter."
"Provide a search term when using this command. :)"
].choose()
Expand Down Expand Up @@ -212,12 +213,20 @@ handler = (msg, match, Haruka) ->
else
"Not available (yet)"

dlc = (
if lucky.dlc
"Yes, give Mr. Sakurai your money."
else
"No, comes with the game."
)

embed = new Discord.RichEmbed()
.setColor lucky.color
.setAuthor title, imgHead, url
.addField 'Echo', echo, true
.addField 'Series', series, true
.addField 'Frame data', (await fdata), true
.addField 'DLC', dlc, true
.setImage imgPanoramic

msg.channel.send embed
Expand All @@ -233,8 +242,7 @@ module.exports = {
```asciidoc
=== Help for Smash ===
*Aliases*: ssbu, smash
-h ssbu :: Function without arguments.
-h ssbu <arg> :: Function with arguments.
-h ssbu <fighter> :: Retrieves information on that specific fighter.
```
"""
}
7 changes: 3 additions & 4 deletions src/functions/wa.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,13 @@ module.exports = {
regex: /^(wa|wolfram|wolframalpha)(\s+|$)/i
handler: handler
help:
short: "-h wa ::
short: "-h wa <query> ::
Ask anything with WolframAlpha."
long: """
```asciidoc
=== Help for WolframAlpha ===
*Aliases*: list, of, aliases
-h fn :: Function without arguments.
-h fn <arg> :: Function with arguments.
*Aliases*: wa, wolfram, wolframalpha
-h wa <query> :: Computes stuff with WolframAlpha
```
"""
}

0 comments on commit c5532d7

Please sign in to comment.