...
 
Commits (4)
......@@ -33,7 +33,7 @@ const DiscordBotClient = new Discord.Client({CLIENT_OPTIONS});
/**
* On message check if it starts with the prefix to execute commands:
* See README for more informations.
* See README for more information.
*/
DiscordBotClient.on('message', async message =>
{
......@@ -167,27 +167,27 @@ DiscordBotClient.on('message', async message =>
return {message:i18n.text.DEFAULT_ERROR};
}
}
case 'profil':
case 'profile':
if (message.mentions.members.size !== 0) {
member = message.mentions.members.first();
}
let getProfilResponse = async () => {
let getProfileResponse = async () => {
try {
let profilData = await rpg.getProfil(member.id);
if (profilData === null) {
let profileData = await rpg.getProfile(member.id);
if (profileData === null) {
return {message:i18n.text.RPG_MEMBER_NOT_REGISTERED.replace('{member}',member.displayName)};
} else {
return {message:{embed:i18n.RPG_PROFIL_EMBED(member.displayName, profilData)}};
return {message:{embed:i18n.RPG_PROFILE_EMBED(member.displayName, profileData)}};
}
} catch (errorCode) {
if (errorCode === rpgConst.CODE_TABLE_NOT_EXITING) {
return await getProfilResponse();
return await getProfileResponse();
} else {
return {message:i18n.text.DB_ERROR};
}
}
};
return await getProfilResponse();
return await getProfileResponse();
case 'list':
let page = Number(arguments[1]) > 0 ? Number(arguments[1]) : 1;
......
{
"dead":"[ ± _ ± ]",
"deal":"(⌐■_■)",
"fuck":"凸( ̄ヘ ̄)",
"gogol":"ᕕ( ᐛ )ᕗ",
"lenny":"( ͡° ͜ʖ ͡°)",
"shrug":"╮( ̄~ ̄)╭",
"tilt":"ლ(ಠ_ಠ ლ)",
"wot":"ಠ_ಠ",
"yeah":"(づ◔ ͜ʖ◔)づ"
{
"dead":"[ ± _ ± ]",
"deal":"(⌐■_■)",
"fuck":"凸( ̄ヘ ̄)",
"gogol":"ᕕ( ᐛ )ᕗ",
"lenny":"( ͡° ͜ʖ ͡°)",
"shrug":"╮( ̄~ ̄)╭",
"tilt":"ლ(ಠ_ಠ ლ)",
"wot":"ಠ_ಠ",
"yeah":"(づ◔ ͜ʖ◔)づ"
}
\ No newline at end of file
......@@ -76,12 +76,12 @@ const register = (userId) => {
};
/**
* Fetches profil data of member in the DataBase.
* Fetches profile data of member in the DataBase.
*
* @param userId
* @returns {Promise}
*/
let getProfil = (userId) => {
let getProfile = (userId) => {
return new Promise(async (resolve, reject) => {
try {
resolve(await getUserData(userId));
......@@ -393,11 +393,11 @@ const revive = (userId) => {
};
module.exports.register = register;
module.exports.getProfil = getProfil;
module.exports.getProfile = getProfile;
module.exports.getNbPlayers = getNbPlayers;
module.exports.getList = getList;
module.exports.daily = daily;
module.exports.attack = attack;
module.exports.heal = heal;
module.exports.give = give;
module.exports.revive = revive;
module.exports.revive = revive;
{
"bandage": "https://cdn.discordapp.com/attachments/168034886869843968/344869145474760705/roast.jpg",
"confused":"http://media.giphy.com/media/hEc4k5pN17GZq/giphy.gif",
"dealwithit":"https://cdn.discordapp.com/attachments/321204152673763330/346365394715410432/dealwithme.png",
"doit":"https://media.tenor.com/images/83f2e6b49b55d7a05ffb07344f2b35a9/tenor.gif",
"facepalm":"http://www.gifbin.com/bin/062010/1275389857_naked-gun-facepalm.gif",
"feelsgood":"http://i0.kym-cdn.com/photos/images/original/000/591/928/94f.png",
"fuck-this-shit":"https://media.giphy.com/media/5IKsrAbEcwrNS/giphy.gif",
"issou":"https://im4.ezgif.com/tmp/ezgif-4-40451dbd0a.gif",
"magic":"https://media.giphy.com/media/12NUbkX6p4xOO4/giphy.gif",
"not-my-business":"http://media3.giphy.com/media/11caUX0P0nYZ32/200.gif#5-grid1",
"retard":"http://i0.kym-cdn.com/entries/icons/original/000/022/940/spongebobicon.jpg",
"rollface":"http://i0.kym-cdn.com/entries/icons/original/000/022/138/reece.JPG",
"salt-bay":"http://i0.kym-cdn.com/photos/images/original/001/234/646/21b.png",
"savage":"https://media.giphy.com/media/xT9IgMw9fhuEGUaJqg/giphy.gif",
"this-is-fine":"http://i.imgur.com/c4jt321.png"
{
"bandage": "https://cdn.discordapp.com/attachments/168034886869843968/344869145474760705/roast.jpg",
"confused":"http://media.giphy.com/media/hEc4k5pN17GZq/giphy.gif",
"dealwithit":"https://cdn.discordapp.com/attachments/321204152673763330/346365394715410432/dealwithme.png",
"doit":"https://media.tenor.com/images/83f2e6b49b55d7a05ffb07344f2b35a9/tenor.gif",
"facepalm":"http://www.gifbin.com/bin/062010/1275389857_naked-gun-facepalm.gif",
"feelsgood":"http://i0.kym-cdn.com/photos/images/original/000/591/928/94f.png",
"fuck-this-shit":"https://media.giphy.com/media/5IKsrAbEcwrNS/giphy.gif",
"issou":"https://im4.ezgif.com/tmp/ezgif-4-40451dbd0a.gif",
"magic":"https://media.giphy.com/media/12NUbkX6p4xOO4/giphy.gif",
"not-my-business":"http://media3.giphy.com/media/11caUX0P0nYZ32/200.gif#5-grid1",
"retard":"http://i0.kym-cdn.com/entries/icons/original/000/022/940/spongebobicon.jpg",
"rollface":"http://i0.kym-cdn.com/entries/icons/original/000/022/138/reece.JPG",
"salt-bay":"http://i0.kym-cdn.com/photos/images/original/001/234/646/21b.png",
"savage":"https://media.giphy.com/media/xT9IgMw9fhuEGUaJqg/giphy.gif",
"this-is-fine":"http://i.imgur.com/c4jt321.png"
}
\ No newline at end of file
......@@ -36,10 +36,12 @@ const text = Object.freeze({
});
const AGE_USER = (member, joinedAt) => {
return new Discord.RichEmbed().setTitle(
getRelativeTimeFromNow(joinedAt,
`${member} vous êtes parmi nous depuis{range}.\nVous êtes arrivé le {calendarDate}.`)
let embed = new Discord.RichEmbed();
embed.addField(
getRelativeTimeFromNow(joinedAt,`Vous êtes arrivé le {calendarDate}.`),
getRelativeTimeFromNow(joinedAt,`${member} vous êtes parmi nous depuis{range}.`)
);
return embed;
};
const DICE_ROLL_EMBED = (member, rollType, roll) => {
......@@ -81,12 +83,14 @@ const HELP_RPG_EMBED = (prefix) => {
return new Discord.RichEmbed()
.setTitle('Commandes RPG')
.addField(`${prefix}register`,'Pour vous inscrire au Jeu !')
.addField(`${prefix}profil [rien/mention]`,':bust_in_silhouette: - Regardez vos stats ou celles d\'un autre joueur')
.addField(`${prefix}profile [rien/mention]`,':bust_in_silhouette: - Regardez vos stats ou celles d\'un autre joueur')
.addField(`${prefix}attack [mention]`,':crossed_swords: - Attaquez un joueur !')
.addField(`${prefix}heal [rien/mention]`,':green_heart: - Soignez vous ou soignez un joueur !')
.addField(`${prefix}give [mention] [amount]`,':gift: - Donnez de l\'argent à un joueur.')
.addField(`${prefix}daily`,
`:calendar_spiral: - Obtenez votre bonus quotidien : énergie rechargée :zap: + ${rpgConst.DAILY_MONEY} :tickets:`);
.addField(
`${prefix}daily`,
`:calendar_spiral: - Obtenez votre bonus quotidien : énergie rechargée :zap: et ${rpgConst.DAILY_MONEY} :tickets:`
);
};
const PING_EMBED = (member, ping) => {
......@@ -94,12 +98,15 @@ const PING_EMBED = (member, ping) => {
.setTitle(`[${member}] :ping_pong: Pong ! \`\`${String(Math.round(ping))}ms\`\``);
};
const RPG_PROFIL_EMBED = (member, data) => {
const RPG_PROFILE_EMBED = (member, data) => {
return new Discord.RichEmbed()
.setTitle(`[Profil] ${member}`)
.addField('Stats', `${data['health_current']}/${data['health_max']} :hearts:\n` +
`ATK ${data['attack']} :crossed_swords:\nMagie ${data['magic']} :cyclone:\n` +
`Energy ${data['energy_current']}/${data['energy_max']} :zap:\nMoney ${data['money']} :tickets:`);
.addField('Profile', `${member}`)
.addField(
'Stats',
`${data['health_current']}/${data['health_max']} :hearts:\n` +
`ATK ${data['attack']} :crossed_swords:\nMagie ${data['magic']} :cyclone:\n` +
`Energy ${data['energy_current']}/${data['energy_max']} :zap:\nMoney ${data['money']} :tickets:`
);
};
const RPG_LIST_EMBED = (data, page, totalPages) => {
......@@ -124,9 +131,10 @@ const RPG_LIST_EMBED = (data, page, totalPages) => {
const RPG_ATTACK_EMBED = (attacker, defender, attackData) => {
return new Discord.RichEmbed()
.setTitle(':crossed_swords: Attaque')
.addField(`${attacker} a blessé ${defender} de ${attackData.damage} PV`,
`${defender} a maintenant ${attackData.health}/${attackData.healthMax} PV`)
.addField(
`:crossed_swords: Attaque`,
`${attacker} a blessé ${defender} de ${attackData.damage} PV\n${defender} a maintenant ${attackData.health}/${attackData.healthMax} PV`
)
.setFooter(`Il vous reste ${attackData.energy} points d'énergie.`)
};
......@@ -139,17 +147,19 @@ const RPG_ATTACK_KILL_EMBED = (defender, attackData) => {
const RPG_HEAL_SELF_EMBED = (caster, healData) => {
return new Discord.RichEmbed()
.setTitle(':green_heart: Auto-Soin')
.addField(`${caster} s'est soigné de ${healData.amountHealed} PV`,
`${caster} a maintenant ${healData.health}/${healData.healthMax} PV`)
.addField(
`:green_heart: Auto-Soin`,
`${caster} s'est soigné de ${healData.amountHealed} PV\n${caster} a maintenant ${healData.health}/${healData.healthMax} PV`
)
.setFooter(`Il vous reste ${healData.energy} points d'énergie.`)
};
const RPG_HEAL_MEMBER_EMBED = (caster, receiver, healData) => {
return new Discord.RichEmbed()
.setTitle(':green_heart: Soin')
.addField(`${caster} a soigné ${receiver} de ${healData.amountHealed} PV`,
`${receiver} a maintenant ${healData.health}/${healData.healthMax} PV`)
.addField(
`:green_heart: Soin`,
`${caster} a soigné ${receiver} de ${healData.amountHealed} PV\n${receiver} a maintenant ${healData.health}/${healData.healthMax} PV`
)
.setFooter(`Il vous reste ${healData.energy} points d'énergie.`)
};
......@@ -232,7 +242,7 @@ module.exports.DICE_STATS_EMBED = DICE_STATS_EMBED;
module.exports.HELP_EMBED = HELP_EMBED;
module.exports.HELP_RPG_EMBED = HELP_RPG_EMBED;
module.exports.PING_EMBED = PING_EMBED;
module.exports.RPG_PROFIL_EMBED = RPG_PROFIL_EMBED;
module.exports.RPG_PROFILE_EMBED = RPG_PROFILE_EMBED;
module.exports.RPG_LIST_EMBED = RPG_LIST_EMBED;
module.exports.RPG_ATTACK = RPG_ATTACK_EMBED;
module.exports.RPG_ATTACK_KILL = RPG_ATTACK_KILL_EMBED;
......
......@@ -16,9 +16,9 @@
}
],
"dependencies": {
"discord.js": "^11.2.1",
"moment": "^2.18.1",
"sqlite": "^2.8.0"
"discord.js": "^11.5.1",
"moment": "^2.24.0",
"sqlite": "^2.9.3"
},
"devDependencies": {
"performance-now": "^2.1.0",
......