This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
embeds.js
76 lines (75 loc) · 2.78 KB
/
embeds.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const discord = require('discord.js')
const color = require('./config.json').color
module.exports = {
/**
*
* @param {discord.CommandInteraction} ita
* @param {String} permission
* @returns {discord.CommandInteraction}
*/
async needperms(ita, permission) {
var embed = new discord.MessageEmbed()
.setColor(color.red)
.setTitle(':x: Zugriff verweigert!')
.setDescription(`Um diesen Befehl auszuführen, benötigst du \`\`${permission}\`\`.`)
if(ita.replied || ita.deferred) await ita.editReply({ embeds: [embed] }).catch()
else await ita.reply({ embeds: [embed], ephemeral: true })
return Promise.resolve(ita)
},
/**
*
* @param {discord.CommandInteraction} ita
* @param {String} title
* @param {String} text
* @returns {discord.CommandInteraction}
*/
async error(ita, title, text) {
var embed = new discord.MessageEmbed()
.setTitle(':x: ' + title)
.setColor(color.red)
.setDescription(text)
if(ita.replied || ita.deferred) await ita.editReply({ embeds: [embed] }).catch()
else await ita.reply({ embeds: [embed], ephemeral: true })
return Promise.resolve(ita)
},
/**
*
* @param {discord.CommandInteraction} ita
* @param {String} title
* @param {String} text
* @returns {discord.CommandInteraction}
*/
async success(ita, title, text) {
var embed = new discord.MessageEmbed()
.setTitle('✅ ' + title)
.setColor(color.lime)
.setDescription(text)
if(ita.replied || ita.deferred) await ita.editReply({ embeds: [embed] }).catch()
else await ita.reply({ embeds: [embed], ephemeral: true }).catch()
return Promise.resolve(ita)
},
/**
*
* @param {discord.CommandInteraction} ita
* @param {String} syntax
* @returns {discord.CommandInteraction}
*/
async syntaxerror(ita, syntax) {
var embed = new discord.MessageEmbed()
.setColor(color.red)
.setTitle(':x: Syntaxfehler')
.setDescription(`Unbekannte Syntax. Bitte verwende:\n\`${syntax}\``)
if(ita.replied || ita.deferred) await ita.editReply({ embeds: [embed] }).catch()
else await ita.reply({ embeds: [embed], ephemeral: true })
return Promise.resolve(ita)
},
async warn(ita, title, text) {
let embed = new discord.MessageEmbed()
.setTitle('⚠️ ' + title)
.setColor(color.yellow)
.setDescription(text)
if(ita.replied || ita.deferred) await ita.editReply({ embeds: [embed] }).catch()
else await ita.reply({ embeds: [embed], ephemeral: true }).catch()
return Promise.resolve(ita)
}
}