-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathglobal.js
executable file
·72 lines (57 loc) · 2.28 KB
/
global.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
global.toID = function (text) {
if (typeof text === 'string') return text.toLowerCase().replace(/[^a-z0-9]/g, '');
};
/**************************
* Modules *
**************************/
// TODO: Add origindb here, ensure these are used wherever possible
global.axios = require('axios');
global.config = require('./config.js');
global.fs = require('fs-extra');
global.https = require('https');
global.levenshtein = require('js-levenshtein');
global.nunjucks = require('nunjucks');
nunjucks.configure('pages/views', { autoescape: true });
global.tools = require('./data/tools.js');
global.url = require('url');
global.util = require('util');
global.BattleAI = require('./data/BATTLE/ai.js').AI;
global.COLORS = require('./data/DATA/colors.json');
global.DATABASE = require('./handlers/database.js');
global.GAMES = require('./data/GAMES/index.js');
/**************************
* Storage *
**************************/
global.queryRoom = '';
global.cooldownObject = {};
global.prefix = config.prefix;
global.websiteLink = config.websiteLink;
/**************************
* Abbreviations *
**************************/
global.unxa = 'Unexpected number of arguments.';
global.tcroom = 'groupchat-partbot-1v1tc';
global.tctest = 'groupchat-partbot-1v1tc';
// eslint-disable-next-line max-len
global.typelist = ['bug', 'dark', 'dragon', 'electric', 'fairy', 'fighting', 'fire', 'flying', 'ghost', 'grass', 'ground', 'ice', 'normal', 'poison', 'psychic', 'rock', 'steel', 'water'];
/**************************
* Data *
**************************/
global.data = {
pokedex: require('./data/DATA/pokedex.json'),
items: require('./data/DATA/items.json'),
moves: require('./data/DATA/moves.json'),
abilities: false,
typechart: require('./data/DATA/typechart.js').BattleTypeChart,
go: require('./data/DATA/go.json'),
unitedex: require('./data/UNITE/pokemon.json'),
unitestats: require('./data/UNITE/stats.json'),
uniteitems: {
battle: require('./data/UNITE/battle_items.json'),
held: require('./data/UNITE/held_items.json')
}
};
global.data.abilities = [...new Set(Object.values(data.pokedex).filter(mon => mon.num > 0).map(mon => {
return Object.values(mon.abilities);
}).reduce((acc, abs) => acc.concat(abs), []))].sort();
// TODO: Add actual ability data