Skip to content
This repository was archived by the owner on Dec 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commands/ban.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
if(mentionHighestRole >= authorHighestRole) return message.channel.send("You can't ban members with an equal or higher position than you.");
if(!mentionedUser.bannable) return message.channel.send("I can't ban this user.");

mentionedUser.send(`🔨 You were banned from **${message.guild.name}**${(banReason !== "no reason specified") ? `, for ${banReason}.` : "."}`)
mentionedUser.send(`🔨 Hi! You got banned from **${message.guild.name}**${(banReason !== "no reason specified") ? ` for ${banReason}.` : "."}`)
.then(() => iHateThis())
.catch(() => iHateThis());

Expand Down
2 changes: 1 addition & 1 deletion commands/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
if(parseInt(args[0]) < 1 || isNaN(parseInt(args[0]))) return message.channel.send(embeds.errorEmbed("You're so funny! But to eat messages, I need the amount of messages you want me to eat **in numbers** - and it should be greater than or equal to **1**."));
if(parseInt(args[0]) > 99) return message.channel.send(embeds.errorEmbed("Sorry, I can only eat 99 messages at a time."));

message.channel.bulkDelete(parseInt(args[0]) + 1).then(() => {
message.channel.bulkDelete(parseInt(args[0]) + 1, true).then(() => {
message.channel.send(format(vukkytils.getString("CLEANED_MESSAGES"), args[0])).then(msg => msg.delete({timeout: 2000}));
});
},
Expand Down
1 change: 1 addition & 0 deletions commands/covid19.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
return res.json();
})
.then(json => {
if(!json) return;
newMessage.edit(format(vukkytils.getString("API_CREDIT"), "https://disease.sh"), embeds.covidEmbed(country ? json.countryInfo.flag : null, country ? json.country : "Global", commaNumber(json.cases), commaNumber(json.todayCases), commaNumber(json.deaths), commaNumber(json.todayDeaths), commaNumber(json.recovered), commaNumber(json.todayRecovered), commaNumber(json.active), commaNumber(json.critical), commaNumber(json.tests)));
});
});
Expand Down
10 changes: 5 additions & 5 deletions commands/emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ module.exports = {
if (args[1].length >= 2) {
let RegExp = /[^a-z^A-Z^0-9]/gm;
if (!RegExp.test(args[1])) {
message.guild.emojis.create((message.attachments).array()[0].url, args[1])
.then(emoji => message.channel.send(successEmbed(`Created new emoji with name ${emoji.name}`)))
.catch(error => message.channel.send(errorEmbed(`Error: ${error.message}`)));
message.guild.emojis.create((message.attachments).array()[0].url, args[1], { reason: `Done by ${message.author.tag}` })
.then(emoji => message.channel.send(successEmbed(`I've made a new emoji called ${emoji.name}!`)))
.catch(error => message.channel.send(errorEmbed(`${error.message}`)));
} else {
message.channel.send(errorEmbed("I found symbols that are not suitable for the name of the emoji!"));
}
Expand All @@ -32,11 +32,11 @@ module.exports = {
message.channel.send(errorEmbed("You didn't give me enough arguments!\nUsage:`emoji add <emojiName>` with an image as attachment."));
}
} else {
if (args[0] == "delete") {
if (args[0] == "delete" || args[0] == "remove") {
if(!message.guild.emojis.cache.get(args[1])) return message.channel.send(embeds.errorEmbed(`\`${args[1]}\` is not an emoji ID.`));
let emoji = message.guild.emojis.cache.get(args[1]);
emoji.delete({ reason: `Done by ${message.author.tag}` });
message.channel.send(embeds.successEmbed(`\`${emoji.name}\` has been deleted!`));
message.channel.send(embeds.successEmbed(`I've deleted \`${emoji.name}\`!`));
} else {
return message.channel.send(embeds.errorEmbed(`${args[0]} is not supported for this command.`));
}
Expand Down
4 changes: 2 additions & 2 deletions commands/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ module.exports = {
const helpEmbed = new Discord.MessageEmbed()
.setColor("#4b83c3")
.setTitle(`ℹ ${command.name}`)
.setDescription(command.description)
.setDescription(command.description || vukkytils.getString("HELP_NO_DESCRIPTION"))
.setTimestamp()
.setFooter(embeds.versionString, embeds.avatarURL);
.setFooter(embeds.versionString, embeds.getAvatarURL());

if (command.aliases) helpEmbed.addField(vukkytils.getString("HELP_ALIASES"), `${command.aliases.join(", ")}`, true);
if (command.usage) helpEmbed.addField(vukkytils.getString("HELP_USAGE"), `${prefix}${command.name} ${command.usage}`, true);
Expand Down
2 changes: 1 addition & 1 deletion commands/kick.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
if(mentionHighestRole >= authorHighestRole) return message.channel.send("You can't kick members with an equal or higher position than you.");
if(!mentionedUser.kickable) return message.channel.send("I can't kick this user.");

mentionedUser.send(`👢 You were kicked from **${message.guild.name}**${(kickReason !== "no reason specified") ? `, for ${kickReason}.` : "."}`)
mentionedUser.send(`👢 Hi! You got kicked from **${message.guild.name}**${(kickReason !== "no reason specified") ? ` for ${kickReason}.` : "."}`)
.then(() => iHateThis())
.catch(() => iHateThis());

Expand Down
5 changes: 5 additions & 0 deletions commands/ohno.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
const canvacord = require("canvacord").Canvas;
const Discord = require("discord.js");
const config = require("../config.json");

module.exports = {
name: "ohno",
description: "oh no! it's stupid",
botPermissions: ["ATTACH_FILES"],
args: true,
usage: "<text>",
async execute(message, args) {
await message.react(config.misc.emoji.loading);
const ohno = await canvacord.ohno(args.slice(0).join(" "));
await message.reactions.removeAll();
message.channel.send(new Discord.MessageAttachment(ohno, "ohno.png"));
},
};
12 changes: 11 additions & 1 deletion commands/opinion.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
const canvacord = require("canvacord").Canvas;
const Discord = require("discord.js");
const config = require("../config.json");

module.exports = {
name: "opinion",
description: "father's son makes an opinion",
botPermissions: ["ATTACH_FILES"],
args: true,
usage: "[user] <text>",
async execute(message, args) {
const opinion = await canvacord.opinion(message.author.avatarURL({ format: "png" }), args.slice(0).join(" "));
await message.react(config.misc.emoji.loading);
let opinion;
if(message.mentions.users.size) {
opinion = await canvacord.opinion(message.mentions.users.first().avatarURL({ format: "png" }), args.slice(1).join(" "));
} else {
opinion = await canvacord.opinion(message.author.avatarURL({ format: "png" }), args.slice(0).join(" "));
}
await message.reactions.removeAll();
message.channel.send(new Discord.MessageAttachment(opinion, "opinion.png"));
},
};
11 changes: 10 additions & 1 deletion commands/rip.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
const canvacord = require("canvacord").Canvas;
const Discord = require("discord.js");
const config = require("../config.json");

module.exports = {
name: "rip",
description: "rip",
botPermissions: ["ATTACH_FILES"],
usage: "[user]",
async execute(message, args) {
const rip = await canvacord.rip(message.author.avatarURL({ format: "png" }));
await message.react(config.misc.emoji.loading);
let rip;
if(message.mentions.users.size) {
rip = await canvacord.rip(message.mentions.users.first().avatarURL({ format: "png" }));
} else {
rip = await canvacord.rip(message.author.avatarURL({ format: "png" }));
}
await message.reactions.removeAll();
message.channel.send(new Discord.MessageAttachment(rip, "rip.png"));
},
};
11 changes: 10 additions & 1 deletion commands/trash.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
const canvacord = require("canvacord").Canvas;
const Discord = require("discord.js");
const config = require("../config.json");

module.exports = {
name: "trash",
description: "trash?",
botPermissions: ["ATTACH_FILES"],
usage: "[user]",
async execute(message, args) {
const trash = await canvacord.trash(message.author.avatarURL({ format: "png" }));
await message.react(config.misc.emoji.loading);
let trash;
if(message.mentions.users.size) {
trash = await canvacord.trash(message.mentions.users.first().avatarURL({ format: "png" }));
} else {
trash = await canvacord.trash(message.author.avatarURL({ format: "png" }));
}
await message.reactions.removeAll();
message.channel.send(new Discord.MessageAttachment(trash, "trash.png"));
},
};
83 changes: 67 additions & 16 deletions commands/tweet.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable no-inner-declarations */
// Copyright (C) 2021 Vukky, vtheskeleton

const embeds = require("../utilities/embeds");
const config = require("../config.json");
const fetch = require("node-fetch");
require("dotenv").config();
var Twitter = require("twitter");
const vukkytils = require("../utilities/vukkytils");
Expand All @@ -13,40 +14,90 @@ module.exports = {
botPermissions: ["EMBED_LINKS", "MANAGE_MESSAGES"],
cooldown: 120,
usage: "<content>",
guildOnly: true,
aliases: ["twt", "tw"],
execute(message, args) {
if(args.slice(0).join(" ").length > 280) return message.channel.send(embeds.errorEmbed("Sorry, but that tweet's too long."));
let attachments = [];
if(message.attachments.first()) attachments = message.attachments.map(attachment => attachment.url);
const tweet = args.slice(0).join(" ");
delete require.cache[require.resolve("../config.json")];
const config = require("../config.json");
let selfdownvote = false;
if(config.commands.tweet.blacklist[message.author.id]) return message.channel.send(embeds.tweetBlacklistEmbed(config.commands.tweet.blacklist[message.author.id]));
if(tweet.length == 0 && attachments.length == 0) return message.channel.send(embeds.errorEmbed("That tweet is pretty empty!"));
if(tweet.length > 280) return message.channel.send(embeds.errorEmbed("Sorry, but that tweet's too long."));
if(attachments.length > 1) return message.channel.send(embeds.errorEmbed("Only 1 attachment at a time is currently supported."));
message.react("⬆").then(() => message.react("⬇"));
const filter = (reaction, user) => {
return ["⬆", "⬇"].includes(reaction.emoji.name) && user.id != message.author.id && user.bot == false;
if(user.bot) return false;
if(reaction.emoji.name == "⬆" && config.misc.owner.includes(user.id)) return true;
if(reaction.emoji.name == "⬆" && user.id == message.author.id) return false;
if(reaction.emoji.name == "⬆" && user.id != message.author.id) return true;
if(reaction.emoji.name == "⬇") {
if(user.id == message.author.id) selfdownvote = true;
return true;
}
return false;
};
message.awaitReactions(filter, { max: 1 })
.then(collected => {
message.reactions.removeAll();
.then(async collected => {
const reaction = collected.first();
if(!reaction || !reaction.emoji || !reaction.emoji.name) return message.channel.send("could not get result");
if(reaction.emoji.name == "⬆") {
await message.reactions.removeAll();
if(reaction.users.cache) console.log(`[twttr] tweet approved by ${reaction.users.cache.last().tag}: ${tweet}`);
var client = new Twitter({
consumer_key: process.env.TWITTER_KEY,
consumer_secret: process.env.TWITTER_SECRET,
access_token_key: process.env.TWITTER_ACCESS,
access_token_secret: process.env.TWITTER_ACCESS_SECRET
});
message.channel.send(`${config.misc.emoji.loading} ${vukkytils.getString("TWEETING")}`).then(tweeting => {
client.post("statuses/update", {status: args.slice(0).join(" ")})
.then(function (tweet) {
tweeting.delete();
message.react("✅");
await message.react(config.misc.emoji.loading);
let status = {
status: tweet
};
if(attachments.length == 1) {
await fetch(attachments[0])
.then(res => res.buffer())
.then(buffer => {
client.post("media/upload", {media: buffer}, async function(error, media) {
if (!error) {
status.media_ids = media.media_id_string;
post();
} else {
console.error(error);
await message.reactions.removeAll();
await message.react("❌");
message.reply("there was an error!", embeds.errorEmbed(`${error.message ? error.message : "Unknown error."}`));
}
});
});
} else {
post();
}
function post() {
client.post("statuses/update", status)
.then(async function (tweet) {
await message.reactions.removeAll();
await message.react("✅");
message.reply(format(vukkytils.getString("TWEET_APPROVED"), `https://twitter.com/i/status/${tweet.id_str}`));
})
.catch(function (error) {
tweeting.delete();
message.react("❌");
.catch(async function (error) {
await message.reactions.removeAll();
await message.react("❌");
message.reply("there was an error!", embeds.errorEmbed(`${error.message ? error.message : "Unknown error."}`));
throw error;
});
});
}
} else if (reaction.emoji.name == "⬇") {
message.react("❌");
message.reply(vukkytils.getString("TWEET_DENIED"));
if(!selfdownvote) {
await message.reactions.removeAll();
if(reaction.users.cache) console.log(`[twttr] tweet denied by ${reaction.users.cache.last().tag}: ${tweet}`);
await message.react("❌");
message.reply(vukkytils.getString("TWEET_DENIED"));
} else {
message.delete();
}
}
});
},
Expand Down
85 changes: 68 additions & 17 deletions commands/tweetreply.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable no-inner-declarations */
// Copyright (C) 2021 Vukky, vtheskeleton

const embeds = require("../utilities/embeds");
const config = require("../config.json");
const fetch = require("node-fetch");
require("dotenv").config();
var Twitter = require("twitter");
const { Util } = require("discord.js");
Expand All @@ -13,45 +14,95 @@ module.exports = {
description: "Make VukkyBot reply to things on Twitter!",
botPermissions: ["EMBED_LINKS", "MANAGE_MESSAGES"],
cooldown: 120,
aliases: ["replytweet"],
aliases: ["replytweet", "twtr", "tweetr", "twr"],
usage: "<tweet ID> <content>",
guildOnly: true,
execute(message, args) {
if(args.slice(1).join(" ").length > 280) return message.channel.send(embeds.errorEmbed("Sorry, but that tweet's too long."));
let attachments = [];
if(message.attachments.first()) attachments = message.attachments.map(attachment => attachment.url);
const tweet = args.slice(1).join(" ");
delete require.cache[require.resolve("../config.json")];
const config = require("../config.json");
let selfdownvote = false;
if(config.commands.tweet.blacklist[message.author.id]) return message.channel.send(embeds.tweetBlacklistEmbed(config.commands.tweet.blacklist[message.author.id]));
if(tweet.length == 0 && attachments.length == 0) return message.channel.send(embeds.errorEmbed("That tweet is pretty empty!"));
if(tweet.length > 280) return message.channel.send(embeds.errorEmbed("Sorry, but that tweet's too long."));
if(isNaN(args[0])) return message.channel.send(embeds.errorEmbed("Your Tweet ID isn't a number!"));
message.react("⬆").then(() => message.react("⬇"));
const filter = (reaction, user) => {
return ["⬆", "⬇"].includes(reaction.emoji.name) && user.id != message.author.id && user.bot == false;
if(user.bot) return false;
if(reaction.emoji.name == "⬆" && config.misc.owner.includes(user.id)) return true;
if(reaction.emoji.name == "⬆" && user.id == message.author.id) return false;
if(reaction.emoji.name == "⬆" && user.id != message.author.id) return true;
if(reaction.emoji.name == "⬇") {
if(user.id == message.author.id) selfdownvote = true;
return true;
}
return false;
};
message.reply(format(vukkytils.getString("TWEET_REPLYING_TO"), Util.removeMentions(`https://twitter.com/i/status/${args[0]}`))).then(tweetreplyDisclaimer => {
message.awaitReactions(filter, { max: 1 })
.then(collected => {
message.reactions.removeAll();
.then(async collected => {
tweetreplyDisclaimer.delete();
const reaction = collected.first();
if(!reaction || !reaction.emoji || !reaction.emoji.name) return message.channel.send("could not get result");
if(reaction.emoji.name == "⬆") {
await message.reactions.removeAll();
if(reaction.users.cache) console.log(`[twttr] tweet reply (${args[0]}) approved by ${reaction.users.cache.last().tag}: ${tweet}`);
var client = new Twitter({
consumer_key: process.env.TWITTER_KEY,
consumer_secret: process.env.TWITTER_SECRET,
access_token_key: process.env.TWITTER_ACCESS,
access_token_secret: process.env.TWITTER_ACCESS_SECRET
});
message.channel.send(`${config.misc.emoji.loading} ${vukkytils.getString("TWEETING")}`).then(tweeting => {
client.post("statuses/update", {status: args.slice(1).join(" "), in_reply_to_status_id: args[0], auto_populate_reply_metadata: true})
.then(function (tweet) {
tweeting.delete();
message.react("✅");
await message.react(config.misc.emoji.loading);
let status = {
status: tweet,
in_reply_to_status_id: args[0],
auto_populate_reply_metadata: true
};
if(attachments.length == 1) {
await fetch(attachments[0])
.then(res => res.buffer())
.then(buffer => {
client.post("media/upload", {media: buffer}, async function(error, media) {
if (!error) {
status.media_ids = media.media_id_string;
post();
} else {
console.error(error);
await message.reactions.removeAll();
await message.react("❌");
message.reply("there was an error!", embeds.errorEmbed(`${error.message ? error.message : "Unknown error."}`));
}
});
});
} else {
post();
}
function post() {
client.post("statuses/update", status)
.then(async function (tweet) {
await message.reactions.removeAll();
await message.react("✅");
message.reply(format(vukkytils.getString("TWEET_APPROVED"), `https://twitter.com/i/status/${tweet.id_str}`));
})
.catch(function (error) {
tweeting.delete();
message.react("❌");
.catch(async function (error) {
await message.reactions.removeAll();
await message.react("❌");
message.reply("there was an error!", embeds.errorEmbed(`${error.message ? error.message : "Unknown error."}`));
throw error;
});
});
}
} else if (reaction.emoji.name == "⬇") {
message.react("❌");
message.reply(vukkytils.getString("TWEET_DENIED"));
if(!selfdownvote) {
await message.reactions.removeAll();
if(reaction.users.cache) console.log(`[twttr] tweet reply (${args[0]}) denied by ${reaction.users.cache.last().tag}: ${tweet}`);
message.react("❌");
message.reply(vukkytils.getString("TWEET_DENIED"));
} else {
message.delete();
}
}
});
});
Expand Down
Loading