Dateien nach "commands/giveaways" hochladen
This commit is contained in:
parent
8d18235233
commit
1b6f612562
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
const { MessageEmbed } = require('discord.js')
|
||||
const ms = require('ms');
|
||||
module.exports = {
|
||||
name: "end",
|
||||
description: "Giveaway beenden",
|
||||
accessableby: "Administrator",
|
||||
category: "giveaway",
|
||||
aliases: ["giveaway-end"],
|
||||
usage: '<giveawaymessageid>',
|
||||
run: async (bot, message, args) => {
|
||||
if(!message.member.hasPermission('MANAGE_MESSAGES') && !message.member.roles.cache.some((r) => r.name === "Giveaways")){
|
||||
return message.channel.send(':x: Sie müssen über die Berechtigung zum Verwalten von Nachrichten verfügen, um Giveaways neu auszurollen.');
|
||||
}
|
||||
|
||||
// If no message ID or giveaway name is specified
|
||||
if(!args[0]){
|
||||
return message.channel.send(':x: Sie müssen eine gültige Nachrichten-ID angeben!');
|
||||
}
|
||||
|
||||
// try to found the giveaway with prize then with ID
|
||||
let giveaway =
|
||||
// Search with giveaway prize
|
||||
bot.giveawaysManager.giveaways.find((g) => g.prize === args.join(' ')) ||
|
||||
// Search with giveaway ID
|
||||
bot.giveawaysManager.giveaways.find((g) => g.messageID === args[0]);
|
||||
|
||||
// If no giveaway was found
|
||||
if(!giveaway){
|
||||
return message.channel.send('Es konnte kein giveaway für `'+ args.join(' ') + '`gefunden werden.');
|
||||
}
|
||||
|
||||
// Edit the giveaway
|
||||
bot.giveawaysManager.edit(giveaway.messageID, {
|
||||
setEndTimestamp: Date.now()
|
||||
})
|
||||
// Success message
|
||||
.then(() => {
|
||||
// Success message
|
||||
message.channel.send('Giveaway endet in weniger als '+(bot.giveawaysManager.options.updateCountdownEvery/1000)+' seconds...');
|
||||
})
|
||||
.catch((e) => {
|
||||
if(e.startsWith(`Giveaway mit Nachrichten-ID ${giveaway.messageID} ist bereits beendet.`)){
|
||||
message.channel.send('Dieses Gewinnspiel ist bereits beendet!');
|
||||
} else {
|
||||
console.error(e);
|
||||
message.channel.send('Es ist ein Fehler aufgetreten...');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
const { MessageEmbed } = require('discord.js')
|
||||
const ms = require('ms');
|
||||
module.exports = {
|
||||
name: "reroll",
|
||||
description:
|
||||
"Get list of all command and even get to know every command detials",
|
||||
usage: "help <cmd>",
|
||||
category:"giveaway",
|
||||
run: async (bot, message, args) => {
|
||||
if(!message.member.hasPermission('MANAGE_MESSAGES') && !message.member.roles.cache.some((r) => r.name === "Giveaways")){
|
||||
return message.channel.send(':x: You need to have the manage messages permissions to reroll giveaways.');
|
||||
}
|
||||
|
||||
// If no message ID or giveaway name is specified
|
||||
if(!args[0]){
|
||||
return message.channel.send(':x: You have to specify a valid message ID!');
|
||||
}
|
||||
|
||||
// try to found the giveaway with prize then with ID
|
||||
let giveaway =
|
||||
// Search with giveaway prize
|
||||
bot.giveawaysManager.giveaways.find((g) => g.prize === args.join(' ')) ||
|
||||
// Search with giveaway ID
|
||||
bot.giveawaysManager.giveaways.find((g) => g.messageID === args[0]);
|
||||
|
||||
// If no giveaway was found
|
||||
if(!giveaway){
|
||||
return message.channel.send('Es kann kein giveaway für `'+ args.join(' ') +'` gefunden werden.');
|
||||
}
|
||||
|
||||
// Reroll the giveaway
|
||||
bot.giveawaysManager.reroll(giveaway.messageID)
|
||||
.then(() => {
|
||||
// Success message
|
||||
message.channel.send('Giveaway neu gerollt!');
|
||||
})
|
||||
.catch((e) => {
|
||||
if(e.startsWith(`Giveaway mit Nachrichten-ID ${giveaway.messageID} ist nicht beendet.`)){
|
||||
message.channel.send('Dieses Gewinnspiel ist noch nicht beendet!');
|
||||
} else {
|
||||
console.error(e);
|
||||
message.channel.send('Es ist ein Fehler aufgetreten...');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
const { MessageEmbed } = require('discord.js')
|
||||
const ms = require('ms');
|
||||
module.exports = {
|
||||
name: "start",
|
||||
description: "Creating giveaway",
|
||||
accessableby: "Administrator",
|
||||
category: "giveaway",
|
||||
aliases: ["giveaway-start"],
|
||||
usage: '<channel> <duration> <winners>, <prize>',
|
||||
run: async (bot, message, args) => {
|
||||
if(!message.member.hasPermission('MANAGE_MESSAGES') && !message.member.roles.cache.some((r) => r.name === "Giveaways")){
|
||||
return message.channel.send(':x: Sie müssen über die Berechtigung zum Verwalten von Nachrichten verfügen, um Werbegeschenke zu starten.');
|
||||
}
|
||||
|
||||
// Giveaway channel
|
||||
let giveawayChannel = message.mentions.channels.first();
|
||||
// If no channel is mentionned
|
||||
if(!giveawayChannel){
|
||||
return message.channel.send(':x: Du musst einen gültigen Kanal angeben!');
|
||||
}
|
||||
|
||||
// Giveaway duration
|
||||
let giveawayDuration = args[1];
|
||||
// If the duration isn't valid
|
||||
if(!giveawayDuration || isNaN(ms(giveawayDuration))){
|
||||
return message.channel.send(':x: Sie müssen eine gültige Dauer angeben!');
|
||||
}
|
||||
|
||||
// Number of winners
|
||||
let giveawayNumberWinners = args[2];
|
||||
// If the specified number of winners is not a number
|
||||
if(isNaN(giveawayNumberWinners) || (parseInt(giveawayNumberWinners) <= 0)){
|
||||
return message.channel.send(':x: Sie müssen eine gültige Anzahl von Gewinnern angeben!');
|
||||
}
|
||||
|
||||
// Giveaway prize
|
||||
let giveawayPrize = args.slice(3).join(' ');
|
||||
// If no prize is specified
|
||||
if(!giveawayPrize){
|
||||
return message.channel.send(':x: Du musst einen gültigen Preis angeben!');
|
||||
}
|
||||
|
||||
// Start the giveaway
|
||||
bot.giveawaysManager.start(giveawayChannel, {
|
||||
// The giveaway duration
|
||||
time: ms(giveawayDuration),
|
||||
// The giveaway prize
|
||||
prize: giveawayPrize,
|
||||
// The giveaway winner count
|
||||
winnerCount: giveawayNumberWinners,
|
||||
// Who hosts this giveaway
|
||||
hostedBy: message.author,
|
||||
// Messages
|
||||
messages: {
|
||||
giveaway: "🎉🎉 **GIVEAWAY** 🎉🎉",
|
||||
giveawayEnded: "🎉🎉 **GIVEAWAY ENDED** 🎉🎉",
|
||||
timeRemaining: "Verbleibende Zeit: **{duration}**!",
|
||||
inviteToParticipate: "Reagiere mit 🎉, um teilzunehmen!",
|
||||
winMessage: "Herzlichen Glückwunsch, {winners}! Du hast **{prize}** gewonnen!",
|
||||
embedFooter: "Giveaways",
|
||||
noWinner: "Gewinnspiel abgesagt, keine gültigen Teilnahmen.",
|
||||
hostedBy: "Gehostet von:",
|
||||
winners: "gewinner",
|
||||
endedAt: "Beendet um",
|
||||
units: {
|
||||
seconds: "seconds",
|
||||
minutes: "minutes",
|
||||
hours: "hours",
|
||||
days: "days",
|
||||
pluralS: false // Not needed, because units end with a S so it will automatically removed if the unit value is lower than 2
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
message.channel.send(`Das Gewinnspiel hat in ${giveawayChannel}begonnen!`);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue