exchangeratesapi can go suck it

This commit is contained in:
Evert Prants 2021-04-15 19:56:45 +03:00
parent dd39ffc54f
commit 909b747bf8
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 72 additions and 76 deletions

View File

@ -47,7 +47,7 @@
}, },
{ {
"name": "utility", "name": "utility",
"version": "3.1.1" "version": "3.1.2"
} }
], ],
"typescript": true "typescript": true

View File

@ -2,7 +2,7 @@
"main": "plugin.js", "main": "plugin.js",
"name": "utility", "name": "utility",
"description": "Utility commands and math operations", "description": "Utility commands and math operations",
"version": "3.1.1", "version": "3.1.2",
"tags": ["commands", "tools"], "tags": ["commands", "tools"],
"dependencies": ["simplecommands"], "dependencies": ["simplecommands"],
"npmDependencies": [ "npmDependencies": [

View File

@ -656,8 +656,6 @@ function addCommands(plugin: UtilityPlugin, commands: any): void {
aliases: ['cv', 'unit'] aliases: ['cv', 'unit']
}); });
const cexkey = plugin.config.get('currencyAPIKey');
if (cexkey) {
cmds.push({ cmds.push({
name: 'currency', name: 'currency',
execute: async (msg: IMessage, msr: MessageResolver, spec: any, prefix: string, ...simplified: any[]): Promise<boolean> => { execute: async (msg: IMessage, msr: MessageResolver, spec: any, prefix: string, ...simplified: any[]): Promise<boolean> => {
@ -665,7 +663,7 @@ function addCommands(plugin: UtilityPlugin, commands: any): void {
if (cexCache.expiry < Date.now()) { if (cexCache.expiry < Date.now()) {
let fetched; let fetched;
try { try {
const data = await httpGET('http://api.exchangeratesapi.io/latest?access_key=' + cexkey); const data = await httpGET('https://api.exchangerate.host/latest');
fetched = JSON.parse(data); fetched = JSON.parse(data);
logger.log('[utility] Fetched currency exchange rates successfully.'); logger.log('[utility] Fetched currency exchange rates successfully.');
} catch (e) { } catch (e) {
@ -735,7 +733,6 @@ function addCommands(plugin: UtilityPlugin, commands: any): void {
usage: '<number> | [date | list] [<from currency>] [<to currency>]', usage: '<number> | [date | list] [<from currency>] [<to currency>]',
aliases: ['cex', 'exchange'] aliases: ['cex', 'exchange']
}); });
}
cmds.push({ cmds.push({
name: 'randomnumber', name: 'randomnumber',
@ -787,7 +784,6 @@ function addCommands(plugin: UtilityPlugin, commands: any): void {
@Configurable({ @Configurable({
ipfsGateway: 'https://ipfs.io', ipfsGateway: 'https://ipfs.io',
currencyAPIKey: '',
randomMax: 64 randomMax: 64
}) })
class UtilityPlugin extends Plugin { class UtilityPlugin extends Plugin {