-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Simyon264/dev
Update 4.9.0
- Loading branch information
Showing
29 changed files
with
1,936 additions
and
697 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const f = require('../functions.js'); | ||
const discord = require('discord.js'); | ||
const fs = require("fs") | ||
|
||
module.exports = { | ||
name: 'achievement', | ||
description: f.localization("commands", "achievement", "exports").description, | ||
category: 'general', | ||
modcommand: false, | ||
usage: f.localization("commands", "achievement", "exports").usage, | ||
perms: '', | ||
alias: ["ac"], | ||
cooldown: 1, | ||
run: async function (message, prefix, args, client) { | ||
if (args.length > 1) { | ||
let id = parseInt(args[1]) | ||
let achievement = f.getAchievement(id) | ||
let valid = false | ||
if (achievement) { | ||
if (achievement.id != -1) valid = true | ||
} | ||
if (valid) { | ||
const embed = new discord.MessageEmbed() | ||
.setColor("RANDOM") | ||
.setTitle(achievement.name) | ||
.setDescription(achievement.description) | ||
.addField("Kategorie:", achievement.category) | ||
.setFooter({ text: "ID: " + achievement.id }) | ||
message.reply({ embeds: [embed] }) | ||
} else { | ||
args.splice(0, 1) | ||
args = args.join(" ") | ||
valid = false | ||
const achievements = JSON.parse(fs.readFileSync("./files/important files/achievements.json")) | ||
for (let index = 0; index < achievements.length; index++) { | ||
const element = achievements[index]; | ||
if (element.name.toLowerCase() == args.toLowerCase()) { | ||
achievement = element | ||
valid = true; | ||
} | ||
} | ||
if (!valid) return message.reply("Achievement nicht gefunden.") | ||
const embed = new discord.MessageEmbed() | ||
.setColor("RANDOM") | ||
.setTitle(achievement.name) | ||
.setDescription(achievement.description) | ||
.addField("Kategorie:", achievement.category) | ||
.setFooter({ text: "ID: " + achievement.id }) | ||
message.reply({ embeds: [embed] }) | ||
} | ||
} else { | ||
message.reply("Bitte gebe eine Achievement an.") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
const f = require('../functions.js'); | ||
const discord = require('discord.js'); | ||
const fs = require("fs") | ||
|
||
module.exports = { | ||
name: 'achievements', | ||
description: f.localization("commands", "achievements", "exports").description, | ||
category: 'general', | ||
modcommand: false, | ||
usage: f.localization("commands", "achievements", "exports").usage, | ||
perms: '', | ||
alias: ["acs"], | ||
cooldown: 1, | ||
run: async function (message, prefix, args, client) { | ||
let page = 1 | ||
if (args[1]) { | ||
let int = parseInt(args[1]) | ||
if (int) { | ||
if (int > 1) { | ||
page = int | ||
} | ||
} | ||
} | ||
|
||
const achievements = JSON.parse(fs.readFileSync("./files/important files/achievements.json")) | ||
|
||
const maxItemsForPage = 5 | ||
const maxpages = Math.ceil(achievements.length / maxItemsForPage) | ||
if (page > maxpages) page = maxpages; | ||
|
||
const link = await f.getLink(message.author.id) | ||
let achievementsLink = [] | ||
if (link) { | ||
achievementsLink = await f.getAchievements(link.idIngame) | ||
if (achievementsLink.length !== 0) { | ||
achievementsLink = JSON.parse(achievementsLink[0].data) | ||
} | ||
} | ||
|
||
const embed = new discord.MessageEmbed() | ||
.setTitle("Alle Achievements") | ||
.setColor("RANDOM") | ||
.setFooter({ text: `${achievements.length} Achievements insgesammt. Seite ${page} von ${maxpages}` }) | ||
|
||
let items = 0 | ||
let count = maxItemsForPage * (page - 1) | ||
for (let index = 0; index < achievements.length; index++) { | ||
if (items !== maxItemsForPage) { | ||
if (count < index || count == index) { | ||
items++ | ||
const element = achievements[index]; | ||
if (achievementsLink.includes(element.id)) { | ||
embed.addField(element.name, `Beschreibung: ${element.description}\nKategorie: ${element.category}\nID: ${element.id}\n**Du hast dieses Achievement.**\n`) | ||
} else { | ||
embed.addField(element.name, `Beschreibung: ${element.description}\nKategorie: ${element.category}\nID: ${element.id}\n`) | ||
} | ||
} | ||
} else { | ||
index = achievements.length | ||
} | ||
} | ||
message.reply({ | ||
embeds: [embed] | ||
}) | ||
} | ||
} |
Oops, something went wrong.