Skip to content

Commit

Permalink
Version 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
LePtitMetalleux committed Aug 10, 2020
1 parent 67eb8c4 commit 56cbac9
Show file tree
Hide file tree
Showing 12 changed files with 319 additions and 125 deletions.
66 changes: 66 additions & 0 deletions commands/Fun/chrono.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const Command = require("../../base/Command.js");
const moment = require("moment")
const { Collection } = require("discord.js")
class Chrono extends Command {
constructor(client) {
super(client, {
name: "chrono",
description: (language) => language.get("CHRONO_DESCRIPTION"),
usage: (language, prefix) => language.get("CHRONO_USAGE", prefix),
examples: (language, prefix) => language.get("CHRONO_EXAMPLES", prefix),
dirname: __dirname,
enabled: true,
guildOnly: false,
permLevel: "User",
botPermissions: ["SEND_MESSAGES"],
aliases: ["stopwatch"],
nsfw: false,
adminOnly: false,
cooldown: 2000,
});
}

async run(message, args) {
try {
const method = args[0];
if(!method) return message.channel.send(message.language.get("CHRONO_METHODS"))
if (method.toLowerCase() !== "start" && method.toLowerCase() !== "stop") return message.channel.send(message.language.get("CHRONO_METHODS"));
if (method.toLowerCase() === "start"){
if (!message.bot.chronos.has(message.guild.id)){
message.bot.chronos.set(message.guild.id, new Collection());
}

const start = moment();
const timestamps = message.bot.chronos.get(message.guild.id);

if (timestamps.has(message.author.id)){
return message.channel.send(message.language.get("CHRONO_RUNNING"))
}
timestamps.set(message.author.id, start);
return message.channel.send(message.language.get("CHRONO_STARTED"))
}
if (method.toLowerCase() === "stop"){
if (!message.bot.chronos.has(message.guild.id)){
message.bot.chronos.set(message.guild.id, new Collection());
}

const stop = moment();
const timestamps = message.bot.chronos.get(message.guild.id);

if (!timestamps.has(message.author.id)){
return message.channel.send(message.language.get("CHRONO_NOT_RUNNING"))
}
const start = timestamps.get(message.author.id)
timestamps.delete(message.author.id)
const duration = stop.diff(start);
const result = (stop.diff(start) >= 3600000 ? moment(duration).format('H:mm:ss:SSS') : moment(duration).format('m:ss:SSS'))
return message.channel.send(message.language.get("CHRONO_STOPPED", result))
}
} catch (error) {
console.error(error);
return message.channel.send(message.language.get("ERROR", error));
}
}
}

module.exports = Chrono;
54 changes: 54 additions & 0 deletions commands/Fun/reminder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const Command = require("../../base/Command.js");
const ms = require("ms")

class Reminder extends Command {
constructor(client) {
super(client, {
name: "reminder",
description: (language) => language.get("REMINDER_DESCRIPTION"),
usage: (language, prefix) => language.get("REMINDER_USAGE", prefix),
examples: (language, prefix) => language.get("REMINDER_EXAMPLES", prefix),
dirname: __dirname,
enabled: true,
guildOnly: false,
permLevel: "User",
botPermissions: ["SEND_MESSAGES"],
aliases: ["rappel", "remind"],
nsfw: false,
adminOnly: false,
cooldown: 2000,
});
}

async run(message, args) {
try {
const time = args[0];
if (!time) return message.channel.send(message.language.get("REMINDER_NO_TIME"))
const toRemind = args.slice(1).join(" ")
if (!toRemind) return message.channel.send(message.language.get("REMINDER_NO_REMIND"))
if (toRemind.lenght > 1900) return message.channel.send(message.language.get("REMINDER_TOO_LONG"))
message.channel.send({
embed: {
title: message.language.get("REMINDER_TITLE"),
description: message.language.get("REMINDER_STARTED", toRemind, ms(ms(time), { long: true })),
color: 0x1EF121
}
})
return setTimeout(() => {
message.channel.send({
embed: {
title: message.language.get("REMINDER_TITLE"),
description: message.language.get("REMINDER_ENDED", toRemind),
color: 0xF40C0C
}
}).then(message.channel.send(`<@!${message.author.id}>`).then((m) => m.delete()))

}, ms(time))
} catch (error) {
console.error(error);
return message.channel.send(message.language.get("ERROR", error));
}
}
}

module.exports = Reminder;
24 changes: 8 additions & 16 deletions commands/General/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ class Update extends Command {
constructor(client) {
super(client, {
name: "update",
description: (language) => language.get("GIVEAWAY_DESCRIPTION"),
usage: (language, prefix) => language.get("GIVEAWAY_USAGE", prefix),
examples: (language, prefix) => language.get("GIVEAWAY_EXAMPLES", prefix),
description: (language) => language.get("UPDATE_DESCRIPTION"),
usage: (language, prefix) => language.get("UPDATE_USAGE", prefix),
examples: (language, prefix) => language.get("UPDATE_EXAMPLES", prefix),
dirname: __dirname,
enabled: true,
guildOnly: true,
permLevel: "User",
botPermissions: ["SEND_MESSAGES"],
aliases: ["updates", "maj"],
nsfw: false,
adminOnly: true,
cooldown: 1000,
Expand All @@ -28,13 +29,8 @@ class Update extends Command {
footer: {
text: message.config.embed.footer
},
title: `Notes de mise à jour | Version ${version}`,
description: `**•** Ajout de sites dans la commande \`vote\`.
**•** Ajout de la compatibilité du système de musique avec les albums et playlists Spotify.
**•** Ajout de la commande \`spotify\` et \`music-youtube\`.
**•** Ajout de la commande \`update\`.
**•** Ajout des commandes \`lock\` et \`unlock\`.
**•** Ajout des commandes \`voicemute\` et \`unvoicemute\`.`,
title: message.language.get("UPDATE_TITLE", version),
description: message.language.get("UPDATE_ADD"),
}
})
return message.channel.send({
Expand All @@ -43,12 +39,8 @@ class Update extends Command {
footer: {
text: message.config.embed.footer
},
title: `Notes de mise à jour | Version ${version}`,
description: `**•** Modification des badges dans la commande \`user-info\`.
**•** "Correction" du bug sur certains serveurs avec les commandes \`anime\`, \`emotes\` et \`weather\` (Le bot requiert la permission \`MANAGE_MESSAGES\` pour ces commandes).
**•** Permissions requises pour chaque commande revues.
**•** Amélioration de la précision des recherches de la commande \`wiki\`.
**•** Correction des commandes de musique qui pouvaient être effectuées sans être dans le salon vocal où est le bot`,
title: message.language.get("UPDATE_TITLE", version),
description: message.language.get("UPDATE_UPDATE"),
}
})
}
Expand Down
6 changes: 3 additions & 3 deletions commands/Moderation/unvoicemute.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const Command = require("../../base/Command.js");

class unmute extends Command {
class unvoicemute extends Command {
constructor(client) {
super(client, {
name: "unmute",
name: "unvoicemute",
description: (language) => language.get("UNVOICEMUTE_DESCRIPTION"),
usage: (language, prefix) => language.get("UNVOICEMUTE_USAGE", prefix),
examples: (language, prefix) => language.get("UNVOICEMUTE_EXAMPLE", prefix),
Expand Down Expand Up @@ -94,4 +94,4 @@ class unmute extends Command {
}
}

module.exports = unmute;
module.exports = unvoicemute;
2 changes: 1 addition & 1 deletion commands/Music/now-playing.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class NowPlaying extends Command {
},
{
name: message.language.get("NOWPLAYING_PROGRESS_BAR"),
value: message.bot.player.createProgressBar(message.guild.id)
value: message.bot.player.createProgressBar(message.guild.id, { durations: true})
}
],
},
Expand Down
26 changes: 17 additions & 9 deletions commands/Music/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,24 @@ class Play extends Command {
if (!song) {
return message.channel.send(message.language.get("PLAY_NO_ARGS"));
}
const matchSpotifyURL = song.match(/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/);
const matchSpotifyTrackURL = song.match(/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/)
const matchSpotifyAlbumURL = song.match(/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:album\/|\?uri=spotify:album:)((\w|-){22})/);
const matchSpotifyPlaylistURL = song.match(/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:playlist\/|\?uri=spotify:playlist:)((\w|-){22})/);
const matchYoutubeURL = song.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/);
var track;
if (matchSpotifyURL) {
track = song;
} else if (matchYoutubeURL) {
track = song;
} else if (ytpl.validateURL(song)) {
track = song;
message.channel.send(message.language.get("SPOTIFY_PLAYLIST_ADDING"))
var track;
if (matchSpotifyTrackURL) {
track = song;
} else if (matchSpotifyAlbumURL) {
track = song;
message.channel.send(message.language.get("SPOTIFY_ALBUM_ADDING"))
} else if (matchSpotifyPlaylistURL) {
track = song;
message.channel.send(message.language.get("SPOTIFY_PLAYLIST_ADDING"))
} else if (matchYoutubeURL) {
track = song;
} else if (ytpl.validateURL(song)) {
track = song;
message.channel.send(message.language.get("SPOTIFY_PLAYLIST_ADDING"))
} else {
// Search for tracks
let tracks = await message.bot.player.searchTracks(song, true);
Expand Down
4 changes: 2 additions & 2 deletions commands/Owner/devlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ class DevLog extends Command {
if (!dlogs) {
return message.channel.send("T'as oublié quelque chose je crois c:")
}
let chan = this.client.guilds.cache.find(g => g.id === "697368051405815860").channels.cache.find(c => c.id === '713736338863685683');
let chan = this.client.guilds.cache.find(g => g.id === "697368051405815860").channels.cache.find(c => c.id === '740500133921423440');
if(!chan) {
return message.channel.send(`Salon d'annonce introuvable`)
}
return chan.send({
embed: {
color: couleur,
footer: {
text: message.config.embed.footer
text: message.config.embed.footer + " - Do update command to see this in another language from everywhere the bot is."
},
title: `Notes de mise à jour | Version ${version}`,
description: dlogs,
Expand Down
5 changes: 3 additions & 2 deletions events/messageUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ module.exports = class {
mysqlcon.query(sql, async function (err, result, fields) {
g = result[0];
if (oldMessage.channel.type === "dm" || newMessage.channel.type === 'dm' || newMessage.author.bot || newMessage.content.indexOf(g.prefix) === 0 || oldMessage.content.indexOf(g.prefix) === 0 ) return;
if (g.logs_channel === null) return;
if (g.logs_channel === null) return this.client.functions.messageEvent(newMessage.bot, newMessage, g);
const lang = new (require(`../languages/${g.language}.js`));
return newMessage.guild.channels.cache.find(c => c.id === g.logs_channel).send({
newMessage.guild.channels.cache.find(c => c.id === g.logs_channel).send({
embed: {
title: lang.get(`LOGS_MESSAGE_UPDATE_TITLE`),
description: lang.get('LOGS_MESSAGE_UPDATE_DESC', oldMessage, newMessage),
Expand All @@ -25,6 +25,7 @@ module.exports = class {
color: 0xDC9017,
}
});
return this.client.functions.messageEvent(newMessage.bot, newMessage, g);
});
}
};
Loading

0 comments on commit 56cbac9

Please sign in to comment.