Compare commits

..

7 commits

7 changed files with 101 additions and 21 deletions

View file

@ -24,9 +24,10 @@ export default {
const member = args.user; const member = args.user;
const message = args.message; const message = args.message;
const attachment = args.image; const attachment = args.image;
const username = member.nickname ? member.nickname : member.user.username;
const webhook = await interaction.channel.createWebhook({ const webhook = await interaction.channel.createWebhook({
name: member.user.username, name: username,
avatar: member.user.displayAvatarURL(), avatar: member.user.displayAvatarURL(),
reason: `Fakebot/user command triggered by: ${interaction.user.username}`, reason: `Fakebot/user command triggered by: ${interaction.user.username}`,
}); });
@ -37,6 +38,12 @@ export default {
await webhook.send({ content: message }); await webhook.send({ content: message });
} }
await webhook.delete(`Fakebot/user command triggered by: ${interaction.user.username}`); await webhook.delete(`Fakebot/user command triggered by: ${interaction.user.username}`);
await interaction.editReply({ content: `Faked the user ${member}` }); if (interaction.isMessage) {
await interaction.delete();
await interaction.deleteReply();
}
else {
await interaction.editReply({ content: `Faked the user ${member}` });
}
}, },
}; };

View file

@ -176,7 +176,7 @@ export default {
const Embed = new EmbedBuilder() const Embed = new EmbedBuilder()
.setAuthor({ name: interaction.user.username, iconURL: interaction.user.displayAvatarURL() }) .setAuthor({ name: interaction.user.username, iconURL: interaction.user.displayAvatarURL() })
.setDescription(tweet) .setDescription(tweet ? tweet : 'No content.')
.addFields( .addFields(
{ name: 'Link', value: TweetLink, inline: true }, { name: 'Link', value: TweetLink, inline: true },
{ name: 'Tweet ID', value: tweetid, inline: true }, { name: 'Tweet ID', value: tweetid, inline: true },

View file

@ -3,9 +3,6 @@ import fs from 'node:fs';
import os from 'node:os'; import os from 'node:os';
import YTPGenerator from 'ytpplus-node'; import YTPGenerator from 'ytpplus-node';
const { prefix } = process.env;
const prefixs = prefix.split(',');
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('ytp') .setName('ytp')
@ -16,7 +13,7 @@ export default {
.setRequired(false)), .setRequired(false)),
category: 'fun', category: 'fun',
async execute(interaction, args) { async execute(interaction, args) {
if (!interaction.channel.nsfw && !args.force) return interaction.reply(`Please execute this command in an NSFW channel ( Content might not be NSFW but since the video are user submitted better safe than sorry ) OR do \`\`${prefixs[0]}ytp --force\`\` to make the command work outside of nsfw channel BE AWARE THAT IT WON'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN`); if (!interaction.channel.nsfw && !args.force) return interaction.reply(`Please execute this command in an NSFW channel ( Content might not be NSFW but since the video are user submitted better safe than sorry ) OR do \`\`${interaction.prefix}ytp --force\`\` to make the command work outside of nsfw channel BE AWARE THAT IT WON'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN`);
// Read userVid folder and select random vid and only take .mp4 // Read userVid folder and select random vid and only take .mp4
const mp4 = []; const mp4 = [];

68
commands/owner/dm.js Normal file
View file

@ -0,0 +1,68 @@
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
// const feedbackID = [];
export default {
data: new SlashCommandBuilder()
.setName('dm')
.setDescription('Replies with Pong!')
.addStringOption(option =>
option.setName('userid')
.setDescription('The user to who you want to send the message to.')
.setRequired(true))
.addStringOption(option =>
option.setName('message')
.setDescription('What do you want to tell them?')
.setRequired(true))
.addAttachmentOption(option =>
option.setName('image')
.setDescription('Optional attachment.')
.setRequired(false)),
category: 'owner',
async execute(interaction, args, client) {
/* Too lazy to implement that now (Watch it rest untouched for months)
async function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
const uuid = uuidv4();
feedbackID[uuid] = args.message;
*/
await client.users.fetch(args.userid);
const user = client.users.resolve(args.userid);
if (!user) return interaction.reply('Not a valid ID');
const text = args.message;
const Embed = new EmbedBuilder()
.setTitle('You received a message from the developer!')
.setDescription(text)
.setFooter({ text: `If you wish to respond use the following command: ${interaction.prefix}feedback <message>` })
.setTimestamp();
user.send({ embeds: [Embed] });
return interaction.reply({ content: `DM sent to ${user.username}`, ephemeral: true });
/*
const Attachment = (message.attachments).array();
if (Attachment[0]) {
client.users.resolve(user).send(Embed, { files: [Attachment[0].url] })
.then(() => {
return interaction.reply(`DM sent to ${user.username}`);
})
.catch(() => {
return interaction.reply(`Could not send a DM to ${user.username}`);
});
}
else {
client.users.resolve(user).send(Embed)
.then(() => {
return interaction.reply(`DM sent to ${user.tag}`);
})
.catch(() => {
return interaction.reply(`Could not send a DM to ${user.tag}`);
});
}
*/
},
};

View file

@ -25,7 +25,7 @@ export default {
const client = interaction.client; const client = interaction.client;
const command = args.command; const command = args.command;
const userid = args.userid; const userid = args.userid;
const reason = args.reason; const reason = args.reason ? args.reason : 'No reason has been specified.';
const blacklist = await Blacklists.findOne({ where: { type:command, uid:userid } }); const blacklist = await Blacklists.findOne({ where: { type:command, uid:userid } });
@ -33,12 +33,11 @@ export default {
const body = { type:command, uid: userid, reason: reason }; const body = { type:command, uid: userid, reason: reason };
Blacklists.create(body); Blacklists.create(body);
let user = userid; let user = userid;
if (command !== 'guild') { await client.users.fetch(userid);
await client.users.resolve(userid); user = client.users.resolve(userid).tag;
user = client.users.fetch(userid).tag;
}
return interaction.editReply(`${user} has been blacklisted from ${command} with the following reason ${reason}`);
return interaction.editReply(`${user} has been blacklisted from ${command} with the following reason \`${reason}\``);
} }
else { else {
const row = new ActionRowBuilder() const row = new ActionRowBuilder()
@ -57,7 +56,7 @@ export default {
await interaction.editReply({ content: 'This user is already blacklisted, do you want to unblacklist him?', ephemeral: true, components: [row] }); await interaction.editReply({ content: 'This user is already blacklisted, do you want to unblacklist him?', ephemeral: true, components: [row] });
interaction.client.on('interactionCreate', async (interactionMenu) => { interaction.client.once('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return; if (interaction.user !== interactionMenu.user) return;
if (!interactionMenu.isButton) return; if (!interactionMenu.isButton) return;
interactionMenu.update({ components: [] }); interactionMenu.update({ components: [] });

View file

@ -75,6 +75,8 @@ export default {
} }
} }
interaction.prefix = '/';
const args = {}; const args = {};
// https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationCommandOptionType // https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationCommandOptionType
interaction.options.data.forEach(arg => { interaction.options.data.forEach(arg => {

View file

@ -2,7 +2,7 @@
* Make this shit work. * Make this shit work.
*/ */
import { EmbedBuilder, PermissionFlagsBits } from 'discord.js'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js';
import db from '../../models/index.js'; import db from '../../models/index.js';
import { rand } from '../../utils/rand.js'; import { rand } from '../../utils/rand.js';
const ratelimit = {}; const ratelimit = {};
@ -337,6 +337,7 @@ export default {
} }
message.user = message.author; message.user = message.author;
message.isMessage = true; message.isMessage = true;
message.prefix = `${messageArray[0]} `;
let waitingmsg; let waitingmsg;
const toDelete = []; const toDelete = [];
@ -368,15 +369,23 @@ export default {
msg.delete(); msg.delete();
}); });
}; };
const args = {};
const args = {};
const argsLength = command.data.options.length; const argsLength = command.data.options.length;
command.data.options.forEach(obj => {
if (obj.type === ApplicationCommandOptionType.Attachment) {
args[obj.name] = message.attachments.first();
}
});
for (let i = 0, j = 0; i < argsLength; i++, j++) { for (let i = 0, j = 0; i < argsLength; i++, j++) {
if (!messageArgs[i]) continue; if (!messageArgs[i]) continue;
const arg = command.data.options[j]; const arg = command.data.options[j];
const type = arg.constructor.name.toLowerCase(); if (arg.type === ApplicationCommandOptionType.Attachment) continue;
let payloadName = arg.name; let payloadName = arg.name;
let payload = messageArgs[i]; let payload = messageArgs[i];
if (i >= argsLength - 1) { if (i >= argsLength - 1) {
payload = messageArgs.slice(i).join(' '); payload = messageArgs.slice(i).join(' ');
} }
@ -386,13 +395,11 @@ export default {
payload = true; payload = true;
j--; j--;
} }
else if (type.includes('mentionable')) {
if (arg.type === ApplicationCommandOptionType.Mentionable) {
await message.guild.members.fetch(); await message.guild.members.fetch();
payload = message.mentions.members.first() ? message.mentions.members.first() : message.guild.members.cache.find(u => u.user.username.toLowerCase().includes(payload.toLowerCase())); payload = message.mentions.members.first() ? message.mentions.members.first() : message.guild.members.cache.find(u => u.user.username.toLowerCase().includes(payload.toLowerCase()));
} }
else if (type.includes('attachment')) {
payload = message.attachments.first();
}
args[payloadName] = payload; args[payloadName] = payload;
} }