Skip to content

Commit

Permalink
Update Eris and fix /define errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Mar 30, 2020
1 parent 3af0d1b commit fa06c43
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@material-ui/core": "^3.0.1",
"@material-ui/icons": "^3.0.1",
"apollo-boost": "^0.1.4",
"eris": "^0.11.1",
"eris": "^0.11.2",
"graphql": "^14.0.2",
"graphql-yoga": "^1.16.7",
"isomorphic-unfetch": "^2.0.0",
Expand Down
7 changes: 5 additions & 2 deletions server/bot/commands/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,16 @@ export const handleDefine: Command = {
`https://od-api.oxforddictionaries.com/api/v2/lemmas/en/${args.join(' ')}`, { headers }
)).json()
// If the word doesn't exist in the Oxford Dictionary..
if (r.error === 'No entries were found for a given inflected word') {
if (r.error === 'No entries were found for a given inflected word' || (
r.error && r.error.startsWith('No lemma was found')
)) {
return 'Did you enter a valid word? 👾'
}
try {
// Here we get the dictionary entries for the specified word.
const word = r.results[0].lexicalEntries[0].inflectionOf[0].id
const { results } = await (await fetch(
`https://od-api.oxforddictionaries.com/api/v2/entries/en/${r.results[0].id}` +
`https://od-api.oxforddictionaries.com/api/v2/entries/en/${word}` +
'?strictMatch=false&fields=definitions%2Cexamples',
{ headers }
)).json()
Expand Down
39 changes: 16 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1569,11 +1569,6 @@ async-each@^1.0.1:
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.2.tgz#8b8a7ca2a658f927e9f307d6d1a42f4199f0f735"
integrity sha512-6xrbvN0MOBKSJDdonmSSz2OwFSgxRaVtBDes26mj9KIGtDo+g9xosFRSC+i1gQh2oAN/tQ62AI/pGZGQjVOiRg==

async-limiter@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==

async-limiter@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
Expand Down Expand Up @@ -2731,15 +2726,15 @@ enhanced-resolve@^4.1.0:
memory-fs "^0.4.0"
tapable "^1.0.0"

eris@^0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/eris/-/eris-0.11.1.tgz#b4c9ba9645c5eef9f9922c2be3c41395a3121a61"
integrity sha512-Ct32iXjESOnmklxZCEA281BQsTlAsS9xzQkbGlnvzXshCjBptWJ5h8Oxbu67ui1DirsYs0WipB8EBC9ITQ5ZQA==
eris@^0.11.2:
version "0.11.2"
resolved "https://registry.yarnpkg.com/eris/-/eris-0.11.2.tgz#a4adad72d795d64d71a74833ccf5adc4db0ad8c0"
integrity sha512-OhccRcxrPiNUylTamrjIbZM6itKMLjNrwLIXGvNwQZj4CRVOOz9eUVIqOJULB713x1ezw7HoC8AEsnsMNUneDA==
dependencies:
ws "^7.1.2"
ws "^7.2.1"
optionalDependencies:
opusscript "^0.0.4"
tweetnacl "^1.0.0"
opusscript "^0.0.7"
tweetnacl "^1.0.1"

errno@^0.1.2, errno@^0.1.3, errno@^0.1.4, errno@~0.1.7:
version "0.1.7"
Expand Down Expand Up @@ -5208,10 +5203,10 @@ optionator@^0.8.2:
type-check "~0.3.2"
wordwrap "~1.0.0"

opusscript@^0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/opusscript/-/opusscript-0.0.4.tgz#c718edcfdcd2a1f55fadb266dd07268d4a46afde"
integrity sha512-bEPZFE2lhUJYQD5yfTFO4RhbRZ937x6hRwBC1YoGacT35bwDVwKFP1+amU8NYfZL/v4EU7ZTU3INTqzYAnuP7Q==
opusscript@^0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/opusscript/-/opusscript-0.0.7.tgz#7dd7ec55b302d26bf588e6fc3feb090b8c7da856"
integrity sha512-DcBadTdYTUuH9zQtepsLjQn4Ll6rs3dmeFvN+SD0ThPnxRBRm/WC1zXWPg+wgAJimB784gdZvUMA57gDP7FdVg==

os-browserify@^0.3.0:
version "0.3.0"
Expand Down Expand Up @@ -6860,7 +6855,7 @@ tty-browserify@0.0.0:
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=

tweetnacl@^1.0.0:
tweetnacl@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.1.tgz#2594d42da73cd036bd0d2a54683dd35a6b55ca17"
integrity sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A==
Expand Down Expand Up @@ -7289,12 +7284,10 @@ ws@^5.2.0:
dependencies:
async-limiter "~1.0.0"

ws@^7.1.2:
version "7.2.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.0.tgz#422eda8c02a4b5dba7744ba66eebbd84bcef0ec7"
integrity sha512-+SqNqFbwTm/0DC18KYzIsMTnEWpLwJsiasW/O17la4iDRRIO9uaHbvKiAS3AHgTiuuWerK/brj4O6MYZkei9xg==
dependencies:
async-limiter "^1.0.0"
ws@^7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.1.tgz#03ed52423cd744084b2cf42ed197c8b65a936b8e"
integrity sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A==

xdg-basedir@^3.0.0:
version "3.0.0"
Expand Down

0 comments on commit fa06c43

Please sign in to comment.