...
 
Commits (2)
......@@ -74,7 +74,7 @@ DiscordBotClient.on('message', async message =>
member = message.mentions.members.first();
}
let guildJoinedAt = guild.member(member).joinedAt;
return {message:{embed:i18n.AGE_USER(member.displayName, guildJoinedAt)}};
return {message:{embed:i18n.AGE_USER(member, guildJoinedAt)}};
case 'ageserv':
return {message:i18n.getRelativeTimeFromNow(guild.createdAt, i18n.text.AGE_SERVER)};
......@@ -124,7 +124,7 @@ DiscordBotClient.on('message', async message =>
return {message:{embed:i18n.HELP_RPG_EMBED(PREFIX)}};
case 'ping':
return {message:{embed:i18n.PING_EMBED(member.displayName, DiscordBotClient.ping)}};
return {message:{embed:i18n.PING_EMBED(member, DiscordBotClient.ping)}};
/** Dice commands */
case 'dstats':
......@@ -134,7 +134,7 @@ DiscordBotClient.on('message', async message =>
let dbRequest = async () => {
try {
let dataDb = await dice.getStats(member.id);
return {message:{embed:i18n.DICE_STATS_EMBED(member.displayName, dataDb)}};
return {message:{embed:i18n.DICE_STATS_EMBED(member, dataDb)}};
} catch (errorCode) {
return {message:i18n.text.DB_ERROR};
}
......@@ -147,7 +147,7 @@ DiscordBotClient.on('message', async message =>
let rollType = Number(commandName.slice(1));
let roll = getRandomInt(1, rollType);
dice.insertRoll(member.id, rollType, roll);
return {message:{embed:i18n.DICE_ROLL_EMBED(member.displayName, rollType, roll)}};
return {message:{embed:i18n.DICE_ROLL_EMBED(member, rollType, roll)}};
/** RPG Commands */
case 'daily':
......@@ -175,9 +175,9 @@ DiscordBotClient.on('message', async message =>
try {
let profileData = await rpg.getProfile(member.id);
if (profileData === null) {
return {message:i18n.text.RPG_MEMBER_NOT_REGISTERED.replace('{member}',member.displayName)};
return {message:i18n.text.RPG_MEMBER_NOT_REGISTERED.replace('{member}',member)};
} else {
return {message:{embed:i18n.RPG_PROFILE_EMBED(member.displayName, profileData)}};
return {message:{embed:i18n.RPG_PROFILE_EMBED(member, profileData)}};
}
} catch (errorCode) {
if (errorCode === rpgConst.CODE_TABLE_NOT_EXITING) {
......@@ -234,16 +234,16 @@ DiscordBotClient.on('message', async message =>
let dataAttack = await rpg.attack(member.id, defender.id);
let attackReply;
if (dataAttack.health <= 0) {
attackReply = i18n.RPG_ATTACK_KILL(defender.displayName, dataAttack);
attackReply = i18n.RPG_ATTACK_KILL(defender, dataAttack);
} else {
attackReply = i18n.RPG_ATTACK(member.displayName, defender.displayName, dataAttack);
attackReply = i18n.RPG_ATTACK(member, defender, dataAttack);
}
return {message:{embed:attackReply}};
} catch (errorCode) {
switch (errorCode) {
case rpgConst.CODE_MEMBER_NOT_REGISTERED:
return {message:i18n.text.RPG_MEMBER_NOT_REGISTERED
.replace('{member}', defender.displayName)};
.replace('{member}', defender)};
case rpgConst.CODE_SELF_NOT_REGISTERED:
return {message:i18n.text.RPG_SELF_NOT_REGISTERED};
......@@ -258,7 +258,7 @@ DiscordBotClient.on('message', async message =>
return {message:i18n.text.RPG_SELF_ATTACK};
case rpgConst.CODE_DEFENDER_ALREADY_DEAD:
return {message:i18n.text.RPG_MEMBER_ALREADY_DEAD.replace('{member}', defender.displayName)};
return {message:i18n.text.RPG_MEMBER_ALREADY_DEAD.replace('{member}', defender)};
case rpgConst.CODE_DB_ERROR:
return {message:i18n.text.DB_ERROR};
......@@ -274,16 +274,16 @@ DiscordBotClient.on('message', async message =>
let healData = await rpg.heal(member.id, receiver.id);
let healEmbed;
if (healData.self === true) {
healEmbed = i18n.RPG_HEAL_SELF(member.displayName, healData);
healEmbed = i18n.RPG_HEAL_SELF(member, healData);
} else {
healEmbed = i18n.RPG_HEAL_MEMBER(member.displayName, receiver.displayName, healData);
healEmbed = i18n.RPG_HEAL_MEMBER(member, receiver, healData);
}
return {message:{embed:healEmbed}};
} catch (errorCode) {
switch (errorCode) {
case rpgConst.CODE_MEMBER_NOT_REGISTERED:
return {message:i18n.text.RPG_MEMBER_NOT_REGISTERED
.replace('{member}', receiver.displayName)};
.replace('{member}', receiver)};
case rpgConst.CODE_SELF_NOT_REGISTERED:
return {message:i18n.text.RPG_SELF_NOT_REGISTERED};
......@@ -298,10 +298,10 @@ DiscordBotClient.on('message', async message =>
return {message:i18n.text.RPG_SELF_MAX_HEALTH};
case rpgConst.CODE_RECEIVER_ALREADY_MAX_HEALTH:
return {message:i18n.text.RPG_MEMBER_MAX_HEALTH.replace('{member}', receiver.displayName)};
return {message:i18n.text.RPG_MEMBER_MAX_HEALTH.replace('{member}', receiver)};
case rpgConst.CODE_RECEIVER_DEAD:
return {message:i18n.text.RPG_MEMBER_DEAD.replace('{member}', receiver.displayName)};
return {message:i18n.text.RPG_MEMBER_DEAD.replace('{member}', receiver)};
case rpgConst.CODE_DB_ERROR:
return {message:i18n.text.DB_ERROR};
......@@ -322,7 +322,7 @@ DiscordBotClient.on('message', async message =>
try {
let giveData = await rpg.give(member.id, receiver.id, amount);
if (giveData === true) {
return {message:{embed:i18n.RPG_MONEY(member.displayName, receiver.displayName, amount)}};
return {message:{embed:i18n.RPG_MONEY(member, receiver, amount)}};
} else {
return {message:i18n.text.DEFAULT_ERROR};
}
......@@ -330,7 +330,7 @@ DiscordBotClient.on('message', async message =>
switch (errorCode) {
case rpgConst.CODE_MEMBER_NOT_REGISTERED:
return {message:i18n.text.RPG_MEMBER_NOT_REGISTERED
.replace('{member}', receiver.displayName)};
.replace('{member}', receiver)};
case rpgConst.CODE_SELF_NOT_REGISTERED:
return {message:i18n.text.RPG_SELF_NOT_REGISTERED};
......
......@@ -37,9 +37,8 @@ const text = Object.freeze({
const AGE_USER = (member, joinedAt) => {
let embed = new Discord.RichEmbed();
embed.addField(
getRelativeTimeFromNow(joinedAt,`Vous êtes arrivé le {calendarDate}.`),
getRelativeTimeFromNow(joinedAt,`${member} vous êtes parmi nous depuis{range}.`)
embed.setTitle(getRelativeTimeFromNow(joinedAt,`Vous êtes arrivé le {calendarDate}.`))
.setDescription(getRelativeTimeFromNow(joinedAt,`${member} vous êtes parmi nous depuis{range}.`)
);
return embed;
};
......@@ -51,7 +50,7 @@ const DICE_ROLL_EMBED = (member, rollType, roll) => {
const DICE_STATS_EMBED = (member, data) => {
let embed = new Discord.RichEmbed()
.setTitle(`:game_die: Statistique de ${member} au lancé de Dés :`);
.setDescription(`:game_die: Statistique de ${member} au lancé de Dés :`);
if (data === null) {
embed.addField('Pas de statistique disponible.', 'Lancez un dé pour avoir des statistiques !')
} else {
......@@ -95,12 +94,13 @@ const HELP_RPG_EMBED = (prefix) => {
const PING_EMBED = (member, ping) => {
return new Discord.RichEmbed()
.setTitle(`[${member}] :ping_pong: Pong ! \`\`${String(Math.round(ping))}ms\`\``);
.setDescription(`[${member}] :ping_pong: Pong ! \`\`${String(Math.round(ping))}ms\`\``);
};
const RPG_PROFILE_EMBED = (member, data) => {
return new Discord.RichEmbed()
.addField('Profile', `${member}`)
.setTitle(`Profile`)
.setDescription(`${member}`)
.addField(
'Stats',
`${data['health_current']}/${data['health_max']} :hearts:\n` +
......@@ -131,8 +131,8 @@ const RPG_LIST_EMBED = (data, page, totalPages) => {
const RPG_ATTACK_EMBED = (attacker, defender, attackData) => {
return new Discord.RichEmbed()
.addField(
`:crossed_swords: Attaque`,
.setTitle(`:crossed_swords: Attaque`)
.setDescription(
`${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.`)
......@@ -147,8 +147,8 @@ const RPG_ATTACK_KILL_EMBED = (defender, attackData) => {
const RPG_HEAL_SELF_EMBED = (caster, healData) => {
return new Discord.RichEmbed()
.addField(
`:green_heart: Auto-Soin`,
.setTitle(`:green_heart: Auto-Soin`)
.setDescription(
`${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.`)
......@@ -156,8 +156,8 @@ const RPG_HEAL_SELF_EMBED = (caster, healData) => {
const RPG_HEAL_MEMBER_EMBED = (caster, receiver, healData) => {
return new Discord.RichEmbed()
.addField(
`:green_heart: Soin`,
.setTitle(`:green_heart: Soin`)
.setDescription(
`${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.`)
......
......@@ -2,7 +2,7 @@
setlocal ENABLEEXTENSIONS
set "bot_name=GLaDOS DISCORD BOT"
set config="config.json"
set cmd_color=12
set cmd_color=0c
title %bot_name%
color %cmd_color%
echo Launching %bot_name%
......