Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- perform(sender: UserInfo, ctx: CommandContext, querySession: QuerySession, resolve: () => void, reject: () => void): void {
- const embed: RichEmbed = new RichEmbed();
- const channels: TextChannel[] = [
- ctx.getDiscordClient().channels.find(value => (value as TextChannel).name === ctx.getConfig().get("channels.aide_modding")) as TextChannel,
- ctx.getDiscordClient().channels.find(value => (value as TextChannel).name === ctx.getConfig().get("channels.recrutement")) as TextChannel,
- ctx.getDiscordClient().channels.find(value => (value as TextChannel).name === ctx.getConfig().get("channels.flood")) as TextChannel
- ];
- const channel: TextChannel = ctx.getDiscordClient().channels.find(value => (value as TextChannel).name === ctx.getConfig().get('channels.rules')) as TextChannel;
- async function clear() {
- let fetched;
- do {
- fetched = await channel.fetchMessages({limit: 1});
- await channel.bulkDelete(fetched);
- } while (fetched.size >= 2);
- }
- clear().then(() => ctx.getLogger().info("Delete all message with success"));
- embed.setTitle(":scroll: RÈGLES DU DISCORD DE MINECRAFT FORGE FRANCE");
- embed.setDescription("───────────────────────────────────");
- embed.setColor(INFO_COLOR);
- embed.setThumbnail("https://cdn.discordapp.com/attachments/270667098143981589/347773487093383189/avatar_128x128_transparent.png");
- if (fs.existsSync("règle.txt")) {
- const fileContent = fs.readFileSync("règle.txt").toString().split("\n");
- for (let i = 0; i < fileContent.length; i++) {
- if (fileContent[i].match(/#([a-zA-Z-]+)/g)) {
- fileContent[i] = fileContent[i].replace(/#([a-zA-Z-]+)/g, (match, name) => {
- let temp: string = "";
- for (const value of channels) {
- if (value.name === name) {
- temp = value.toString();
- }
- }
- return temp;
- });
- }
- embed.addField(`${i + 1}.`, fileContent[i]);
- }
- channel.send(embed);
- }
- resolve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement