Fixed some bugs

This commit is contained in:
CorwinDev 2022-12-20 20:33:56 +01:00
parent 8076a73383
commit f0ff38a676
6 changed files with 72 additions and 15 deletions

View file

@ -7,7 +7,8 @@ module.exports = async (client, interaction, args) => {
if (text.length >= 2000) return client.errNormal({ error: "You may not use more than 2000 characters!", type: 'editreply' }, interaction);
interaction.channel.createWebhook(user.username, {
interaction.channel.createWebhook({
name: user.username,
avatar: user.displayAvatarURL(),
}).then(async (_webhook) => {
await _webhook.send(client.removeMentions(text));

View file

@ -1,12 +1,14 @@
const { Canvas } = require("canvacord");
const Discord = require("discord.js");
module.exports = async (client, interaction, args) => {
const clydeMessage = interaction.options.getString('text');
client.embed({
title: `🖼・Clyde`,
image: `https://ctk-api.herokuapp.com/clyde/${encodeURIComponent(clydeMessage)}`,
type: 'editreply'
}, interaction)
const image = await Canvas.clyde(clydeMessage)
const attachment = new Discord.AttachmentBuilder(image, "clyde.png");
interaction.editReply({ files: [attachment] });
}

View file

@ -1,5 +1,5 @@
const Discord = require('discord.js');
const pop = require("popcat-wrapper");
const { Canvas } = require("canvacord");
module.exports = async (client, interaction, args) => {
@ -7,7 +7,7 @@ module.exports = async (client, interaction, args) => {
const userAvatar = member.displayAvatarURL({ dynamic: false, size: 1024, format: 'png' });
const image = await pop.colorify(userAvatar);
const image = await Canvas.colorfy(userAvatar, "#ff0000")
let attach = new Discord.AttachmentBuilder(image, { name: "colorify.png" });
interaction.editReply({ files: [attach] })

View file

@ -1,15 +1,15 @@
const Discord = require('discord.js');
const pop = require("popcat-wrapper");
const { Canvas } = require("canvacord");
module.exports = async (client, interaction, args) => {
const member = interaction.options.getUser('user');
const userAvatar = member.displayAvatarURL({ dynamic: false, size: 1024, format: 'png' });
const image = await pop.greyscale(userAvatar);
const image = await Canvas.greyscale(userAvatar)
let attach = new Discord.AttachmentBuilder(image, { name: "greyscale.png" });
interaction.editReply({ files: [attach] })
}

View file

@ -6,13 +6,12 @@ module.exports = async (client, interaction, args) => {
const user2 = interaction.options.getUser('user2') || interaction.user;
const user3 = interaction.options.getUser('user3') || interaction.user;
var user1Avatar = user1.displayAvatarURL({ dynamic: false, size: 1024, format: 'png' });
var user2Avatar = user2.displayAvatarURL({ dynamic: false, size: 1024, format: 'png' });
var user3Avatar = user3.displayAvatarURL({ dynamic: false, size: 1024, format: 'png' });
var user1Avatar = user1.displayAvatarURL({ dynamic: false, size: 1024, extension: 'png' });
var user2Avatar = user2.displayAvatarURL({ dynamic: false, size: 1024, extension: 'png' });
var user3Avatar = user3.displayAvatarURL({ dynamic: false, size: 1024, extension: 'png' });
var img = await new DIG.Podium().getImage(user1Avatar, user2Avatar, user3Avatar, user1.tag, user2.tag, user3.tag);
var attach = new Discord.AttachmentBuilder(img, { name: "podium.png" });
interaction.editReply({ files: [attach] })
}

View file

@ -140,3 +140,58 @@ manager.on('shardCreate', shard => {
manager.spawn();
// Webhooks
const consoleLogs = new Discord.WebhookClient({
id: webhook.consoleLogs.id,
token: webhook.consoleLogs.token,
});
const warnLogs = new Discord.WebhookClient({
id: webhook.warnLogs.id,
token: webhook.warnLogs.token,
});
process.on('unhandledRejection', error => {
console.error('Unhandled promise rejection:', error);
if (error) if (error.length > 950) error = error.slice(0, 950) + '... view console for details';
if (error.stack) if (error.stack.length > 950) error.stack = error.stack.slice(0, 950) + '... view console for details';
if (!error.stack) return
const embed = new Discord.EmbedBuilder()
.setTitle(`🚨・Unhandled promise rejection`)
.addFields([
{
name: "Error",
value: error ? Discord.codeBlock(error) : "No error",
},
{
name: "Stack error",
value: error.stack ? Discord.codeBlock(error.stack) : "No stack error",
}
])
.setColor(client.config.colors.normal)
consoleLogs.send({
username: 'Bot Logs',
embeds: [embed],
}).catch(() => {
console.log(error)
})
});
process.on('warning', warn => {
const embed = new Discord.EmbedBuilder()
.setTitle(`🚨・New warning found`)
.addFields([
{
name: `Warn`,
value: `\`\`\`${warn}\`\`\``,
},
])
.setColor(client.config.colors.normal)
warnLogs.send({
username: 'Bot Logs',
embeds: [embed],
}).catch(() => {
})
});