Dateien nach "commands/utility" hochladen

This commit is contained in:
M_Viper 2024-02-07 14:49:12 +00:00
parent 51c1724784
commit e978f3c96d
9 changed files with 491 additions and 0 deletions

View File

@ -0,0 +1,98 @@
const discord = require("discord.js");
const sourcebin = require('sourcebin_js');
module.exports = {
name: "discriminator",
usage: `discrim 0007`,
category: "utility",
aliases: ["discrim"],
run: async (client, message, args) => {
let men = message.mentions.users.first();
let discrims;
let dis;
let content;
if (men) {
discrims = client.users.cache.filter(user => user.discriminator === men.discriminator).map(user => user.tag);
dis = client.users.cache.filter(user => user.discriminator === men.discriminator).map(user => user.discriminator);
}
if (!men) {
if (args[0]) {
discrims = client.users.cache.filter(user => user.discriminator === args[0].replace('#', "")).map(user => user.tag);
dis = client.users.cache.filter(user => user.discriminator === args[0].replace('#', "")).map(user => user.discriminator);
}
}
if (!args[0]) {
discrims = client.users.cache.filter(user => user.discriminator === message.author.discriminator).map(user => user.tag);
dis = client.users.cache.filter(user => user.discriminator === message.author.discriminator).map(user => user.discriminator);
}
if (!discrims.length) return message.reply("Ich kann keine Benutzer mit diesem Diskriminator finden");
if (discrims[0]) {
content = `\`#1\` - **${discrims[0]}**`
}
if (discrims[1]) {
content += `\n#2 - ${discrims[1]}`
}
if (discrims[2]) {
content += `\n#3 - ${discrims[2]}`
}
if (discrims[3]) {
content = `\n#4 - ${discrims[3]}`
}
if (discrims[4]) {
content = `\n#5 - ${discrims[4]}`
}
if (discrims[5]) {
content = `\n#6 - ${discrims[5]}`
}
if (discrims[6]) {
content = `\n#7 - ${discrims[6]}`
}
if (discrims[7]) {
content = `\n#8 - ${discrims[7]}`
}
if (discrims[8]) {
content = `\n#9 - ${discrims[8]}`
}
if (discrims[9]) {
content = `\n#10 - ${discrims[9]}`
}
sourcebin.create([{
name: `Discriminators‏`,
content: discrims.join('\n'),
languageId: 'text'
}])
.then(src => {
let embed = new discord.MessageEmbed()
.setTitle(`Users with ${dis[0]}`)
.setDescription(`${content}\n\n**[Url](${src.url})**`)
.setFooter(`${discrims.length} Benutzer gefunden,`, client.user.displayAvatarURL())
message.channel.send(embed);
})
.catch(e => {
message.channel.send(`Fehler, versuchen Sie es später erneut`)
});
}
}

View File

@ -0,0 +1,101 @@
const discord = require('discord.js')
const fetch = require("node-fetch")
module.exports = {
name: "findemoji",
aliases: ["finde", "fe"],
category: "utility",
description: "Stiehlt Emoji von anderen Servern auf Ihren Server.",
authorPermission: ["MANAGE_EMOJIS"],
run: async (client, message, args) => {
if (!message.member.hasPermission("MANAGE_EMOJIS")) {
return message.channel.send(`Sie haben keine Berechtigung, diesen Befehl zu verwenden! Emojis verwalten`)
}
let emojis = await fetch("https://emoji.gg/api/").then(res => res.json());
const q = args.join(" ").toLowerCase().trim().split(" ").join("_");
let matches = emojis.filter(s => s.title == q || s.title.includes(q));
let noResult = new discord.MessageEmbed()
.setDescription(`| :x: No Results found for ${args.join(" ")}!`)
.setColor("FF2052")
if (!matches.length) return message.channel.send(noResult)
let page = 0;
let embed = new discord.MessageEmbed()
.setTitle(matches[page].title)
.setURL("https://discordemoji.com/emoji/" + matches[page].slug)
.setColor("00FFFF")
.setImage(matches[page].image)
.setFooter(`Emoji ${page + 1}/${matches.length}`);
const msg = await message.channel.send(embed);
emojis = ["◀️", "▶️", "✅", "❌"];
msg.react(emojis[0]);
msg.react(emojis[1]);
msg.react(emojis[2]);
msg.react(emojis[3]);
const filter = (r, u) => emojis.includes(r.emoji.name.trim()) && u.id == message.author.id;
let doing = true;
while (doing) {
let reaction;
try { reaction = await msg.awaitReactions(filter, { max: 1, time: 120000, errors: ["time"] })}
catch { message.channel.send(message.author.toString() + ", Du hast zu lange gebraucht."); msg.reactions.removeAll() ; doing = false; return; };
reaction = reaction.first();
const rmsg = reaction.message;
if (reaction.emoji.name == emojis[0]) {
page--;
if (!matches[page]) {
page++;
rmsg.reactions.resolve(reaction.emoji.name).users.remove(message.author.id).catch(err => {})
} else {
let newembed = new discord.MessageEmbed()
.setTitle(matches[page].title)
.setURL("https://discordemoji.com/emoji/" + matches[page].slug)
.setColor("00FFFF")
.setImage(matches[page].image)
.setFooter(`Emoji ${page + 1}/${matches.length}`);
msg.edit(newembed);
rmsg.reactions.resolve(reaction.emoji.name).users.remove(message.author.id).catch(err => {})
}
} else if (reaction.emoji.name == emojis[1]) {
page++;
if (!matches[page]) {
page--;
rmsg.reactions.resolve(reaction.emoji.name).users.remove(message.author.id).catch(err => {})
} else {
let newembed = new discord.MessageEmbed()
.setTitle(matches[page].title)
.setURL("https://discordemoji.com/emoji/" + matches[page].slug)
.setColor("00FFFF")
.setImage(matches[page].image)
.setFooter(`Emoji ${page + 1}/${matches.length}`);
msg.edit(newembed);
rmsg.reactions.resolve(reaction.emoji.name).users.remove(message.author.id).catch(err => {})
}
} else if (reaction.emoji.name == emojis[2]) {
const res = matches[page];
let created;
message.channel.startTyping();
try {
created = await message.guild.emojis.create(res.image, res.title);
message.channel.stopTyping();
} catch {
message.channel.stopTyping();
message.channel.send(`${res.title} kann nicht hinzugefügt werden..`);
rmsg.reactions.resolve(reaction.emoji.name).users.remove(message.author.id).catch(err => {})
doing = false;
break;
}
message.channel.send(`Erfolgreich hinzugefügt ${created}!`);
rmsg.reactions.resolve(reaction.emoji.name).users.remove(message.author.id).catch(err => {})
doing = false;
break;
} else if (reaction.emoji.name == emojis[3]) {
message.channel.send("Befehl Abbrechen.");
msg.reactions.removeAll();
return;
}};
}
}

36
commands/utility/greet.js Normal file
View File

@ -0,0 +1,36 @@
const discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const guildDB = require("../../mongo/guildDB");
module.exports = {
name: "greet",
description: "Toogles-Greet-System",
usage: ``,
category: "utility",
aliases: ["greet"],
run: async (client, message, args) => {
message.delete().catch(() => {});
if (!message.member.hasPermission("ADMINISTRATOR"))
return message.channel.send(`:x: Fehlende Berechtigung`);
let channel = message.mentions.channels.first() || message.channel;
let data = await guildDB.find({ guild: message.guild.id })
if(!data?.length) {
await guildDB.create({
guild: message.guild.id,
channel: channel.id,
})
message.reply({
content: `Begrüssung für ${channel} aktiviert.`
})
} else {
var ch = data.map((guildDB) => {
return [ `${guildDB.channel}` ]})
guildDB.updateOne({ guild: message.guild.id }, { channel: ch + channel.id }, function(err, res) {});
message.reply({
content: `Begrüssung für ${channel} aktiviert.`
})
}
}
}

View File

@ -0,0 +1,62 @@
const discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const config = require("../../config");
const guildDB = require("../../mongo/guildDB");
module.exports = {
name: "greetmsg",
description: "Toogles-Greet-System",
usage: ``,
category: "utility",
aliases: ["greet"],
run: async (client, message, args) => {
message.delete().catch(() => {});
if (!message.member.hasPermission("ADMINISTRATOR"))
return message.channel.send(`:x: Fehlende Berechtigung`)
let db = await greetDB.find({ guild: message.guild.id });
if (!args[0])
return message.channel.send(
new discord.MessageEmbed().setColor("00FFFF").setDescription(
`<:GlobalCross:772424814824390677> **Sie haben keine neuen Beitrittsnachrichten bereitgestellt. Weitere Hilfe finden Sie unten.**
**__Variablen, die in Begrüßungsnachrichten verwendet werden können__**
\`[member:mention]\` **=>** \`pings member\`
\`[gilde:name]\` **=>** \`zeigt den Gildennamen an\`
\`[guild:membercount]\` **=>** \`zeigt die Anzahl der Gildenmitglieder an\`
**__Aktuelle Begrüßungsnachricht__**
${db.Message || "[member:mention] Willkommen bei [guild:name]"}
`
)
);
if (!db) {
let newDB = new guildDB({
guild: message.guild.id,
message: args.slice(0).join(" "),
channel: null,
});
await newDB.save();
let m = await message.channel.send(
new discord.MessageEmbed()
.setDescription(`**Geänderte Begrüßungsnachricht**`)
.setColor("00FFFF")
);
setTimeout(() => {
m.delete().catch(() => {});
}, 3000);
} else {
db.Message = args.slice(0).join(" ");
await db.save();
let m = await message.channel.send(
new discord.MessageEmbed()
.setDescription(`**Geänderte Begrüßungsnachricht**`)
.setColor("00FFFF")
);
setTimeout(() => {
m.delete().catch(() => {});
}, 3000);
}
}
};

View File

@ -0,0 +1,36 @@
const discord = require("discord.js");
const { RichEmbed } = require("discord.js");
const fetch = require("node-fetch");
const moment = require("moment");
const sourcebin = require("sourcebin_js");
module.exports = {
name: "haste",
usage: `haste <code/text>`,
category: "utility",
args: true,
aliases: ["haste"],
run: async (client, message, args) => {
message.delete();
const Content = args.join(" ");
sourcebin
.create([
{
title: "JavaScript code",
description: 'Dieser Code wurde in "' + message.createdAt + '"',
name: "Hergestellt von " + message.author.username,
content: Content,
languageId: "JavaScript"
}
])
.then(src => {
let embed = new discord.MessageEmbed()
.setTitle(`Hastebin`)
.setColor("RANDOM")
.setDescription(`Code:\n${Content}\n\n**[Click Here](${src.url})**`);
message.channel.send(embed);
})
.catch(e => {
message.channel.send(`Fehler, versuchen Sie es später erneut`);
});
}
};

1
commands/utility/lol Normal file
View File

@ -0,0 +1 @@

96
commands/utility/oldgreet Normal file
View File

@ -0,0 +1,96 @@
let db = await greetDB.findOne({ guild: message.guild.id });
if (!db) {
let db = new greetDB({
guild: message.guild.id,
channel: channel.id,
message: "[member:mention] Welcome to [guild:name]",
});
let m = await message.channel.send(
new discord.MessageEmbed()
.setDescription(`**${message.author.tag}**`)
.addField(
"**<a:tickYes:904267903191351326> Enabled greet messages for this**",
"**channel**"
)
.setThumbnail(client.user.displayAvatarURL())
.setTimestamp()
.setFooter(
`Saturn bot`,
client.user.displayAvatarURL()
)
);
setTimeout(() => {
m.delete().catch(() => {});
}, 300000);
return;
} else {
if (!db.channel) {
greetDB.updateOne({ guild: message.guild.id }, { channel: channel.id })
let m = await message.channel.send(
new discord.MessageEmbed()
.setDescription(`**${message.author.tag}**`)
.addField(
"**<a:tickYes:904267903191351326> Enabled greet messages for this**",
"**channel**"
)
.setThumbnail(client.user.displayAvatarURL())
.setTimestamp()
.setFooter(
`Saturn bot`,
client.user.displayAvatarURL()
)
);
setTimeout(() => {
m.delete().catch(() => {});
}, 300000);
return;
}
if (db.channel === channel.id) {
guildDB.updateOne({ guild: message.guild.id }, { channel: channel.id }, function(err, res) {});
let m = await message.channel.send(
new discord.MessageEmbed()
.setDescription(`**${message.author.tag}**`)
.addField(
"**<:npg_cross:904267907100442636> Disabled greet messages from this**",
"**channel**"
)
.setThumbnail(client.user.displayAvatarURL())
.setTimestamp()
.setFooter(
`Saturn bot`,
client.user.displayAvatarURL()
)
);
setTimeout(() => {
m.delete().catch(() => {});
}, 300000);
return;
}/* else {
db.channel = channel.id;
await db.save();
let m = await message.channel.send(
new discord.MessageEmbed()
.setDescription(`**${message.author.tag}**`)
.addField(
"**<a:tickYes:904267903191351326> Enabled greet messages for this**",
"**channel**"
)
.setThumbnail(client.user.displayAvatarURL())
.setTimestamp()
.setFooter(
`Saturn bot`,
client.user.displayAvatarURL()
)
)};
setTimeout(() => {
m.delete().catch(() => {});
}, 300000);
return;
}
}*/
}
}
}

25
commands/utility/sudo.js Normal file
View File

@ -0,0 +1,25 @@
module.exports = {
name: "sudo",
description: "Erstellt einen Webhook, um sich als jemand auszugeben",
usage: "sudo <user> <message>",
category: "utility",
args: true,
cooldown: 5,
botpermission: ["MANAGE_WEBHOOKS"],
run: async (client, message, args) => {
if (!message.member.hasPermission("MANAGE_WEBHOOKS")) {
return message.channel.send(`Sie haben keine Berechtigung, diesen Befehl zu verwenden! Webhook verwalten`)}
message.delete();
let user =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]);
if (!user) return message.channel.send("Bitte geben Sie einen Benutzer an!");
const webhook = await message.channel.createWebhook(user.displayName, {
avatar: user.user.displayAvatarURL(),
channel: message.channel.id
});
await webhook.send(args.slice(1).join(" ")).then(() => {
webhook.delete();
});
}
};

View File

@ -0,0 +1,36 @@
const discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { UniqueID } = require('nodejs-snowflake');
module.exports = {
name: "timedif",
description: "Zeit differenzieren",
usage: ``,
category: "utility",
aliases: ["timedif"],
run: async (client, message, args) => {
let time1 = args[0];
let time2 = args[1];
const uid = new UniqueID(time1);
const t1 = uid.getTimestampFromID(time1);
const uid2 = new UniqueID(time2);
const t2 = uid2.getTimestampFromID(time2);
if(!time1) {
return message.reply("missing arguments")
} else if (!time2) {
return message.reply("Missing arguments")
}
else{
const embed = new MessageEmbed()
.setTitle('Zeit differenzieren')
.setColor("#1a8cff")
.setDescription(`${(t2-t1)/1000} seconds`)
.setFooter(message.member.displayName, message.author.displayAvatarURL({ dynamic: true }));
message.channel.send(embed)
}
}}