-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathRPGBot.js
More file actions
executable file
·116 lines (103 loc) · 2.76 KB
/
RPGBot.js
File metadata and controls
executable file
·116 lines (103 loc) · 2.76 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License.
require("dotenv").config();
const { RPGBOT_TOKEN, RPGBOT_PREFIX, OWNER_ID } = process.env;
const { CommandoClient } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const path = require('path');
const Enmap = require('enmap');
const client = new CommandoClient({
commandPrefix: RPGBOT_PREFIX,
unknownCommandResponse: false,
owner: OWNER_ID,
disableEveryone: true
});
// Client Settings
client.equip = new Enmap({name:"equip"})
client.boosters = new Enmap({name:"boosters"})
client.profile = new Enmap({name:"profile"})
client.clash = new Enmap({name:"guild"})
client.util = new Enmap({name:"util"})
client.marketplace = new Enmap({name:"marketplace"})
client.adventure = new Enmap({name:"adventure"})
client.registry
.registerDefaultTypes()
.registerGroups([
['roleplay', 'Roleplay'],
['other', 'Other'],
['profile', 'Profile'],
['clash', 'Clash']
])
.registerDefaultGroups()
.registerDefaultCommands({help: false})
.registerCommandsIn(path.join(__dirname, 'commands'));
// Client Events
client.on('ready', () => {
console.log('Up and running!');
client.user.setActivity('!help');
});
client.on('message', msg => {
if (msg.author.bot) return;
client.boosters.ensure(msg.author.id, {
xp: "disabled",
xptime: "no",
})
client.profile.ensure(`${msg.author.id}`, {
orbs: 0,
weapons: [],
id: msg.author.id,
items: [],
level: 1,
lastCollected: "no",
pets: [],
character: "none",
workers: [],
levelpoints: 0,
damage: 0,
started: "no",
elo: 100,
health: 0,
})
client.equip.ensure(msg.author.id, {
boots: [],
necklace: [],
sword: [],
bow: [],
helmet: [],
shield: [],
leggings: [],
staff: [],
chestplate: [],
pet: [],
spell: [],
})
client.util.ensure(client.user.id, {
guildnames: [],
weaponids: 1,
})
client.clash.ensure(`${msg.author.id}`, {
name: "none",
members: 0,
id: "none",
role: 'none',
deposits: [],
orbs: 0,
storage: [],
memberids: [],
})
const curLevel = Math.floor(0.1 * Math.sqrt(client.profile.get(`${msg.author.id}`, "levelpoints")));
if (client.profile.get(`${msg.author.id}`, "level") < curLevel) {
let money = curLevel * 50 / 0.50
let embed = new RichEmbed()
.setAuthor(`🆙`, msg.author.displayAvatarURL)
.setDescription(`Congrats, you've leveled up to level **${curLevel}**!\nReward: **${money} 🔮**`)
.setColor("RANDOM")
msg.channel.send(embed)
client.profile.math(msg.author.id, "+", money, "orbs")
client.profile.set(`${msg.author.id}`, curLevel, "level");
}
})
/*
client.on('guildCreate', guild => {
})
*/
client.login(RPGBOT_TOKEN);