Serial Designation N
Serial Designation N
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 7/21/2024 in #djs-questions
canvas is not registering my font
Why is canvas not using my installed font? i am using await registerFont("Fonts/gagalin/Gagalin-Regular.otf", { family: 'fontFamily' }) but it says
(process:12608): Pango-WARNING **: 18:48:06.051: couldn't load font "Gagalin Not-Rotated 60px", falling back to "Sans Not-Rotated 60px", expect ugly output.

(process:12608): Pango-WARNING **: 18:48:06.081: couldn't load font "Gagalin 60px", falling back to "Sans 60px", expect ugly output.

(process:12608): Pango-WARNING **: 18:48:06.086: couldn't load font "Gagalin Not-Rotated 75px", falling back to "Sans Not-Rotated 75px", expect ugly output.
(process:12608): Pango-WARNING **: 18:48:06.051: couldn't load font "Gagalin Not-Rotated 60px", falling back to "Sans Not-Rotated 60px", expect ugly output.

(process:12608): Pango-WARNING **: 18:48:06.081: couldn't load font "Gagalin 60px", falling back to "Sans 60px", expect ugly output.

(process:12608): Pango-WARNING **: 18:48:06.086: couldn't load font "Gagalin Not-Rotated 75px", falling back to "Sans Not-Rotated 75px", expect ugly output.
2 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 7/17/2024 in #djs-questions
Unknown message when deleting bot messages
My message delete event throws me an error when i delete bot messages.
DiscordAPIError[10008]: Unknown Message
at handleErrors (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildMessageManager.edit (/workspace/Prismatic/node_modules/discord.js/src/managers/MessageManager.js:188:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
enforce_nonce: false,
embeds: undefined,
components: [],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined,
applied_tags: undefined,
poll: undefined
}
},
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/1127359832685547702/messages/1263084219647660125'
} Promise {
<rejected> DiscordAPIError[10008]: Unknown Message
at handleErrors (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildMessageManager.edit (/workspace/Prismatic/node_modules/discord.js/src/managers/MessageManager.js:188:15) {
requestBody: { files: [], json: [Object] },
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/1127359832685547702/messages/1263084219647660125'
}
}
DiscordAPIError[10008]: Unknown Message
at handleErrors (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildMessageManager.edit (/workspace/Prismatic/node_modules/discord.js/src/managers/MessageManager.js:188:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
enforce_nonce: false,
embeds: undefined,
components: [],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined,
applied_tags: undefined,
poll: undefined
}
},
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/1127359832685547702/messages/1263084219647660125'
} Promise {
<rejected> DiscordAPIError[10008]: Unknown Message
at handleErrors (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/workspace/Prismatic/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildMessageManager.edit (/workspace/Prismatic/node_modules/discord.js/src/managers/MessageManager.js:188:15) {
requestBody: { files: [], json: [Object] },
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/1127359832685547702/messages/1263084219647660125'
}
}
11 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 7/13/2024 in #djs-questions
Nuke Protection
Does anyone have a code that will protect my server from nukes? Or a tutorial?
13 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 5/13/2024 in #djs-questions
addFields choose position
Can i choose a index when adding a new field to my embed?
4 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 4/22/2024 in #djs-questions
automoderationRules
2 Questions: - How can i fetch autorules with triggerType 1 - How to edit the rules (updating the keywordFilter)
8 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 11/10/2023 in #djs-voice
cannot hear my bot
Hi. I found my old "play-mp3" command. However, when I tried it out it didn't play any audio. The code doesn't throw any errors. Now I have no idea whether it's me or the bot.
const { SlashCommandBuilder } = require('@discordjs/builders');
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require('@discordjs/voice');
const { ChannelType, EmbedBuilder } = require('discord.js');
const path = require('path');
module.exports = {
data: new SlashCommandBuilder()
.setName('play-mp3')
.setDescription('Spielt eine MP3-Datei ab.')
.addStringOption(option =>
option.setName('song')
.setDescription('-')
.setRequired(true)
.addChoices(
{
name: 'Song 1', value: `Third_Party_Normal`
},
))
.addChannelOption((option) => option.setName('channel').setDescription('Voicechannel').setRequired(true).addChannelTypes(ChannelType.GuildVoice)),
async execute(interaction) {
const track = await interaction.options.getString('song');
try {
const vchannel = interaction.options.getChannel('channel');
global.connection = joinVoiceChannel({
channelId: vchannel.id,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
selfDeaf: true,
selfMute: false
});
global.connection.on('debug', (m) => {
console.log('Voice Debug:', m);
});
} catch (error) {
console.error(error);
await interaction.reply('Es gab einen Fehler beim Abspielen der Musik.');
}
try {
const player = createAudioPlayer();
const resource = createAudioResource(`./src/media/${track}.mp3`);
player.play(resource);
global.connection.subscribe(player);
await interaction.reply({
embeds: [
new EmbedBuilder()
.setTitle("Playing Audio!")
.setDescription(`Now playing ---| ${track} |---`)
.setFooter({ text: `Nachricht von ${interaction.user.tag} am ${new Date().toLocaleString()}` })
]
})
} catch (error) {
console.error(error);
await interaction.reply('Es gab einen Fehler beim Abspielen der Musik.');
}
},
};
const { SlashCommandBuilder } = require('@discordjs/builders');
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require('@discordjs/voice');
const { ChannelType, EmbedBuilder } = require('discord.js');
const path = require('path');
module.exports = {
data: new SlashCommandBuilder()
.setName('play-mp3')
.setDescription('Spielt eine MP3-Datei ab.')
.addStringOption(option =>
option.setName('song')
.setDescription('-')
.setRequired(true)
.addChoices(
{
name: 'Song 1', value: `Third_Party_Normal`
},
))
.addChannelOption((option) => option.setName('channel').setDescription('Voicechannel').setRequired(true).addChannelTypes(ChannelType.GuildVoice)),
async execute(interaction) {
const track = await interaction.options.getString('song');
try {
const vchannel = interaction.options.getChannel('channel');
global.connection = joinVoiceChannel({
channelId: vchannel.id,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
selfDeaf: true,
selfMute: false
});
global.connection.on('debug', (m) => {
console.log('Voice Debug:', m);
});
} catch (error) {
console.error(error);
await interaction.reply('Es gab einen Fehler beim Abspielen der Musik.');
}
try {
const player = createAudioPlayer();
const resource = createAudioResource(`./src/media/${track}.mp3`);
player.play(resource);
global.connection.subscribe(player);
await interaction.reply({
embeds: [
new EmbedBuilder()
.setTitle("Playing Audio!")
.setDescription(`Now playing ---| ${track} |---`)
.setFooter({ text: `Nachricht von ${interaction.user.tag} am ${new Date().toLocaleString()}` })
]
})
} catch (error) {
console.error(error);
await interaction.reply('Es gab einen Fehler beim Abspielen der Musik.');
}
},
};
7 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 7/14/2023 in #djs-questions
Why do I have my commands twice?
17 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 7/13/2023 in #djs-questions
Cannot read properties of undefined (reading 'Flags')
My Code:
const { SlashCommandBuilder } = require("@discordjs/builders")
const { EmbedBuilder, PermissionsBitFieldBitField } = require("discord.js")

module.exports = {
data: new SlashCommandBuilder()
.setName("kick")
.setDescription("Kicke einen User vom Server!")
.addUserOption(option => option.setName("user").setDescription("Der entsprechende User!").setRequired(true))
.addStringOption(option => option.setName("reason").setDescription("Begründung für den Kick!")),
async execute (interaction, client )
{
const user = interaction.options.getUser("user")
const kickMember = await interaction.guild.members.fetch(user.id)
const channel = interaction.channel

if (!interaction.member.permissions.has(PermissionsBitFieldBitField.Flags.kickMember)) return await interaction.reply({ content: "Du hast nicht die Berechtigung dazu, Member zu kicken!"})
if (!kickMember) return await interaction.reply({ content: "User nicht gefunden!"})
if (!kickMember.kickable) return await interaction.reply({ content: "Ich kann diesen User nicht kicken!"})

let reason = interaction.options.getString("reason")

if (!reason) reason = "No reason given!"

const dmEmbed = new EmbedBuilder()
.setColor("Blue")
.setDescription(`Du wurdest von **${interaction.guild.name} gekickt! | ${reason}`)

const embed = new EmbedBuilder()
.setColor("Blue")
.setDescription(`${user.tag} has been kicked! | ${reason}`)

await kickMember.send({ embeds: [dmEmbed]}).catch(err => {
return
})

await kickMember.kick({ reason: reason}).catch(err => {
interaction.reply({ content: "There was an error"})
})

await interaction.reply({ embeds: [embed]})

}
}
const { SlashCommandBuilder } = require("@discordjs/builders")
const { EmbedBuilder, PermissionsBitFieldBitField } = require("discord.js")

module.exports = {
data: new SlashCommandBuilder()
.setName("kick")
.setDescription("Kicke einen User vom Server!")
.addUserOption(option => option.setName("user").setDescription("Der entsprechende User!").setRequired(true))
.addStringOption(option => option.setName("reason").setDescription("Begründung für den Kick!")),
async execute (interaction, client )
{
const user = interaction.options.getUser("user")
const kickMember = await interaction.guild.members.fetch(user.id)
const channel = interaction.channel

if (!interaction.member.permissions.has(PermissionsBitFieldBitField.Flags.kickMember)) return await interaction.reply({ content: "Du hast nicht die Berechtigung dazu, Member zu kicken!"})
if (!kickMember) return await interaction.reply({ content: "User nicht gefunden!"})
if (!kickMember.kickable) return await interaction.reply({ content: "Ich kann diesen User nicht kicken!"})

let reason = interaction.options.getString("reason")

if (!reason) reason = "No reason given!"

const dmEmbed = new EmbedBuilder()
.setColor("Blue")
.setDescription(`Du wurdest von **${interaction.guild.name} gekickt! | ${reason}`)

const embed = new EmbedBuilder()
.setColor("Blue")
.setDescription(`${user.tag} has been kicked! | ${reason}`)

await kickMember.send({ embeds: [dmEmbed]}).catch(err => {
return
})

await kickMember.kick({ reason: reason}).catch(err => {
interaction.reply({ content: "There was an error"})
})

await interaction.reply({ embeds: [embed]})

}
}
Error: TypeError: Cannot read properties of undefined (reading 'Flags') What´s wrong?
18 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 7/13/2023 in #djs-questions
How do I get the number of roles that a user has on the server?
How do I get the number of roles that a user has on the server?
6 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 3/8/2023 in #djs-voice
yt audio player aborted
what is happening here?
const { SlashCommandBuilder } = require('@discordjs/builders');
const { VoiceConnection, createAudioResource, StreamType, joinVoiceChannel, createAudioPlayer } = require('@discordjs/voice');
const { ChannelType } = require('discord.js');
const ytdl = require('ytdl-core-discord');

module.exports = {
data: new SlashCommandBuilder()
.setName('play-yt')
.setDescription('Spielt einen YouTube-Link in einem Voice-Channel ab.')
.addStringOption(option =>
option.setName('url')
.setDescription('Der YouTube-Link, der abgespielt werden soll.')
.setRequired(true))
.addChannelOption((option) => option.setName('channel').setDescription('Voicechannel').setRequired(true).addChannelTypes(ChannelType.GuildVoice)),
async execute(interaction) {
const url = interaction.options.getString('url');
const voiceChannel = interaction.member.voice.channel;

if (!voiceChannel) {
return interaction.reply('error');
}

try {
const vchannel = interaction.options.getChannel('channel');
const vconnection = joinVoiceChannel({
channelId: vchannel.id,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
selfDeaf: true,
selfMute: false
});

const stream = await ytdl(url, { filter: 'audioonly', quality: 'highestaudio' });
const vplayer = createAudioPlayer();

const vresource = createAudioResource(stream, { inputType: StreamType.Opus });

vplayer.play(vresource);
vconnection.subscribe(vplayer);

await interaction.reply(`Spiele \`${url}\` ab.`);

} catch (error) {
console.error(error);
interaction.reply('error');
}
},
};
const { SlashCommandBuilder } = require('@discordjs/builders');
const { VoiceConnection, createAudioResource, StreamType, joinVoiceChannel, createAudioPlayer } = require('@discordjs/voice');
const { ChannelType } = require('discord.js');
const ytdl = require('ytdl-core-discord');

module.exports = {
data: new SlashCommandBuilder()
.setName('play-yt')
.setDescription('Spielt einen YouTube-Link in einem Voice-Channel ab.')
.addStringOption(option =>
option.setName('url')
.setDescription('Der YouTube-Link, der abgespielt werden soll.')
.setRequired(true))
.addChannelOption((option) => option.setName('channel').setDescription('Voicechannel').setRequired(true).addChannelTypes(ChannelType.GuildVoice)),
async execute(interaction) {
const url = interaction.options.getString('url');
const voiceChannel = interaction.member.voice.channel;

if (!voiceChannel) {
return interaction.reply('error');
}

try {
const vchannel = interaction.options.getChannel('channel');
const vconnection = joinVoiceChannel({
channelId: vchannel.id,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
selfDeaf: true,
selfMute: false
});

const stream = await ytdl(url, { filter: 'audioonly', quality: 'highestaudio' });
const vplayer = createAudioPlayer();

const vresource = createAudioResource(stream, { inputType: StreamType.Opus });

vplayer.play(vresource);
vconnection.subscribe(vplayer);

await interaction.reply(`Spiele \`${url}\` ab.`);

} catch (error) {
console.error(error);
interaction.reply('error');
}
},
};
6 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 3/1/2023 in #djs-voice
audio problem
i have this problem: in the middle of the mp3 you can no longer hear my bot in the channel. after that you don't hear it until I restart it or i restarted discord. But today everything was going well until it suddenly started. What could be the cause?
42 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 2/28/2023 in #djs-voice
Why is there no musik?
What's wrong? I am using discord.js 14.7.1
6 replies
DIAdiscord.js - Imagine a bot
Created by Serial Designation N on 2/17/2023 in #djs-questions
How can I make slash commands available in dm's?
I want to use my bot's commands in his dm's but i can only use them in my server. how i can make them avilable in dm's too?
26 replies