WhacK
WhacK
Explore posts from servers
SIASapphire - Imagine a framework
Created by WhacK on 7/22/2024 in #sapphire-support
manual task compiler error
The heading might not be the best here but I tried searching and the docs but can't figure out what I am doing wrong. I used the scheduled tasks plugin. I've been using it for a while and my bot runs certain pattern tasks with no issue. I want to create a manual task that deletes a message if it's deletable after a set period of time. I followed the directions here https://github.com/sapphiredev/plugins/blob/1f0ca075501324013b7a79410ee4bc04ebad9720/packages/scheduled-tasks/README.md#manual-task-example My compiler is giving this error: Expected 1-2 arguments, but got 3.ts(2554)
15 replies
DIAdiscord.js - Imagine an app
Created by WhacK on 3/7/2024 in #djs-questions
reply to message with channel webhook
Is it possible to use Webhook.send() to reply to a message in the same channel? I followed the docs and it makes it look like you could add the reply parameter to the MessagePayload.create() and set the reference like described in this question in this forum https://discord.com/channels/222078108977594368/1171346142823460886. This is the code I am using. The message sends to the right channel and everything but it doesn't show the reference like other replies.
public async sendRpMessage(options: WebhookMessageCreateOptions, channel: GuildTextBasedChannel, char: Character, msgToReply: Message = null) {
let opts = {
username: parseServerNickname(char),
avatarURL: char.avatar_url,
...options
};
if (channel.isThread()) {
opts = { threadId: channel.id, ...opts };
}
const rpHook = await this.findOrCreateRpHook(channel);
if (rpHook) {
if (msgToReply) {
const payload = MessagePayload.create(rpHook, { reply: { messageReference: msgToReply.id }, ...opts });
return rpHook.send(payload);
}

return rpHook.send(opts);
} else {
console.log('unable to find or create webhook for:' + channel.id);
}
return null;
}
public async sendRpMessage(options: WebhookMessageCreateOptions, channel: GuildTextBasedChannel, char: Character, msgToReply: Message = null) {
let opts = {
username: parseServerNickname(char),
avatarURL: char.avatar_url,
...options
};
if (channel.isThread()) {
opts = { threadId: channel.id, ...opts };
}
const rpHook = await this.findOrCreateRpHook(channel);
if (rpHook) {
if (msgToReply) {
const payload = MessagePayload.create(rpHook, { reply: { messageReference: msgToReply.id }, ...opts });
return rpHook.send(payload);
}

return rpHook.send(opts);
} else {
console.log('unable to find or create webhook for:' + channel.id);
}
return null;
}
10 replies
DIAdiscord.js - Imagine an app
Created by WhacK on 9/18/2023 in #djs-questions
Channel.messages.fetch(id) giving mixed results
My bot uses the embed fields to match an Array from the embed to their character stats. On Desktop this issue doesn't seem to happen. When testing the submit command from mobile the statRoll message is giving me 2 different values. Sometimes the embeds are there and sometimes they are gone. Everything else looks to be the same. Correct response (no errors):
{
channelId: "984143582027972681",
guildId: "984143580241211412",
id: "1152294200927334420",
createdTimestamp: 1694798746092,
type: 0,
system: false,
content: "<@1080207865861644328> rolled stats...",
author: {
id: "261302296103747584",
bot: true,
system: false,
flags: {
bitfield: 65536,
},
username: "Avrae",
globalName: null,
discriminator: "6944",
avatar: "b4926b52f7f1c966e01e25f0b33253f1",
banner: null,
accentColor: null,
avatarDecoration: null,
},
pinned: false,
tts: false,
nonce: null,
embeds: [
{
data: {
type: "rich",
title: "Generating Random Stats",
description: "**Server Settings:**\n● Minimum of 72\n● Maximum of 86\n● At least 2 over 14\n● At least 1 under 12",
color: 15036310,
fields: [
{
name: "Stats",
value: "**Stat 1:** 4d6kh3 (~~**1**~~, **6**, 3, **6**) = `15`\n**Stat 2:** 4d6kh3 (~~2~~, **6**, 4, **6**) = `16`\n**Stat 3:** 4d6kh3 (2, 5, ~~2~~, 3) = `10`\n**Stat 4:** 4d6kh3 (**6**, ~~3~~, 4, 5) = `15`\n**Stat 5:** 4d6kh3 (3, **6**, **6**, ~~2~~) = `15`\n**Stat 6:** 4d6kh3 (2, **6**, 3, ~~2~~) = `11`\n-----\nTotal = `82`",
inline: true,
},
],
},
},
],
components: [
],
attachments: {
},
stickers: {
},
position: null,
roleSubscriptionData: null,
editedTimestamp: null,
reactions: {
message: [Circular],
},
mentions: {
everyone: false,
users: {
},
roles: {
},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: {
},
repliedUser: null,
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: {
bitfield: 0,
},
reference: null,
interaction: null,
}
{
channelId: "984143582027972681",
guildId: "984143580241211412",
id: "1152294200927334420",
createdTimestamp: 1694798746092,
type: 0,
system: false,
content: "<@1080207865861644328> rolled stats...",
author: {
id: "261302296103747584",
bot: true,
system: false,
flags: {
bitfield: 65536,
},
username: "Avrae",
globalName: null,
discriminator: "6944",
avatar: "b4926b52f7f1c966e01e25f0b33253f1",
banner: null,
accentColor: null,
avatarDecoration: null,
},
pinned: false,
tts: false,
nonce: null,
embeds: [
{
data: {
type: "rich",
title: "Generating Random Stats",
description: "**Server Settings:**\n● Minimum of 72\n● Maximum of 86\n● At least 2 over 14\n● At least 1 under 12",
color: 15036310,
fields: [
{
name: "Stats",
value: "**Stat 1:** 4d6kh3 (~~**1**~~, **6**, 3, **6**) = `15`\n**Stat 2:** 4d6kh3 (~~2~~, **6**, 4, **6**) = `16`\n**Stat 3:** 4d6kh3 (2, 5, ~~2~~, 3) = `10`\n**Stat 4:** 4d6kh3 (**6**, ~~3~~, 4, 5) = `15`\n**Stat 5:** 4d6kh3 (3, **6**, **6**, ~~2~~) = `15`\n**Stat 6:** 4d6kh3 (2, **6**, 3, ~~2~~) = `11`\n-----\nTotal = `82`",
inline: true,
},
],
},
},
],
components: [
],
attachments: {
},
stickers: {
},
position: null,
roleSubscriptionData: null,
editedTimestamp: null,
reactions: {
message: [Circular],
},
mentions: {
everyone: false,
users: {
},
roles: {
},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: {
},
repliedUser: null,
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: {
bitfield: 0,
},
reference: null,
interaction: null,
}
Embeds missing:
{
channelId: "984143582027972681",
guildId: "984143580241211412",
id: "1152294200927334420",
createdTimestamp: 1694798746092,
type: 0,
system: false,
content: "<@1080207865861644328> rolled stats...",
author: {
id: "261302296103747584",
bot: true,
system: false,
flags: {
bitfield: 65536,
},
username: "Avrae",
globalName: null,
discriminator: "6944",
avatar: "b4926b52f7f1c966e01e25f0b33253f1",
banner: null,
accentColor: null,
avatarDecoration: null,
},
pinned: false,
tts: false,
nonce: null,
embeds: [
],
components: [
],
attachments: {
},
stickers: {
},
position: null,
roleSubscriptionData: null,
editedTimestamp: null,
reactions: {
message: [Circular],
},
mentions: {
everyone: false,
users: {
},
roles: {
},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: {
},
repliedUser: null,
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: {
bitfield: 0,
},
reference: null,
interaction: null,
}
{
channelId: "984143582027972681",
guildId: "984143580241211412",
id: "1152294200927334420",
createdTimestamp: 1694798746092,
type: 0,
system: false,
content: "<@1080207865861644328> rolled stats...",
author: {
id: "261302296103747584",
bot: true,
system: false,
flags: {
bitfield: 65536,
},
username: "Avrae",
globalName: null,
discriminator: "6944",
avatar: "b4926b52f7f1c966e01e25f0b33253f1",
banner: null,
accentColor: null,
avatarDecoration: null,
},
pinned: false,
tts: false,
nonce: null,
embeds: [
],
components: [
],
attachments: {
},
stickers: {
},
position: null,
roleSubscriptionData: null,
editedTimestamp: null,
reactions: {
message: [Circular],
},
mentions: {
everyone: false,
users: {
},
roles: {
},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: {
},
repliedUser: null,
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: {
bitfield: 0,
},
reference: null,
interaction: null,
}
26 replies
SIASapphire - Imagine a framework
Created by WhacK on 9/17/2023 in #discordjs-support
Channel.messages.fetch getting different values
My bot uses the embed fields to match an Array from the embed to their character stats. On Desktop this issue doesn't seem to happen. When testing the submit command from mobile the statRoll message is giving me 2 different values. Sometimes the embeds are there and sometimes they are gone. Everything else looks to be the same. Correct response (no errors):
{
channelId: "984143582027972681",
guildId: "984143580241211412",
id: "1152294200927334420",
createdTimestamp: 1694798746092,
type: 0,
system: false,
content: "<@1080207865861644328> rolled stats...",
author: {
id: "261302296103747584",
bot: true,
system: false,
flags: {
bitfield: 65536,
},
username: "Avrae",
globalName: null,
discriminator: "6944",
avatar: "b4926b52f7f1c966e01e25f0b33253f1",
banner: null,
accentColor: null,
avatarDecoration: null,
},
pinned: false,
tts: false,
nonce: null,
embeds: [
{
data: {
type: "rich",
title: "Generating Random Stats",
description: "**Server Settings:**\n● Minimum of 72\n● Maximum of 86\n● At least 2 over 14\n● At least 1 under 12",
color: 15036310,
fields: [
{
name: "Stats",
value: "**Stat 1:** 4d6kh3 (~~**1**~~, **6**, 3, **6**) = `15`\n**Stat 2:** 4d6kh3 (~~2~~, **6**, 4, **6**) = `16`\n**Stat 3:** 4d6kh3 (2, 5, ~~2~~, 3) = `10`\n**Stat 4:** 4d6kh3 (**6**, ~~3~~, 4, 5) = `15`\n**Stat 5:** 4d6kh3 (3, **6**, **6**, ~~2~~) = `15`\n**Stat 6:** 4d6kh3 (2, **6**, 3, ~~2~~) = `11`\n-----\nTotal = `82`",
inline: true,
},
],
},
},
],
components: [
],
attachments: {
},
stickers: {
},
position: null,
roleSubscriptionData: null,
editedTimestamp: null,
reactions: {
message: [Circular],
},
mentions: {
everyone: false,
users: {
},
roles: {
},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: {
},
repliedUser: null,
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: {
bitfield: 0,
},
reference: null,
interaction: null,
}
{
channelId: "984143582027972681",
guildId: "984143580241211412",
id: "1152294200927334420",
createdTimestamp: 1694798746092,
type: 0,
system: false,
content: "<@1080207865861644328> rolled stats...",
author: {
id: "261302296103747584",
bot: true,
system: false,
flags: {
bitfield: 65536,
},
username: "Avrae",
globalName: null,
discriminator: "6944",
avatar: "b4926b52f7f1c966e01e25f0b33253f1",
banner: null,
accentColor: null,
avatarDecoration: null,
},
pinned: false,
tts: false,
nonce: null,
embeds: [
{
data: {
type: "rich",
title: "Generating Random Stats",
description: "**Server Settings:**\n● Minimum of 72\n● Maximum of 86\n● At least 2 over 14\n● At least 1 under 12",
color: 15036310,
fields: [
{
name: "Stats",
value: "**Stat 1:** 4d6kh3 (~~**1**~~, **6**, 3, **6**) = `15`\n**Stat 2:** 4d6kh3 (~~2~~, **6**, 4, **6**) = `16`\n**Stat 3:** 4d6kh3 (2, 5, ~~2~~, 3) = `10`\n**Stat 4:** 4d6kh3 (**6**, ~~3~~, 4, 5) = `15`\n**Stat 5:** 4d6kh3 (3, **6**, **6**, ~~2~~) = `15`\n**Stat 6:** 4d6kh3 (2, **6**, 3, ~~2~~) = `11`\n-----\nTotal = `82`",
inline: true,
},
],
},
},
],
components: [
],
attachments: {
},
stickers: {
},
position: null,
roleSubscriptionData: null,
editedTimestamp: null,
reactions: {
message: [Circular],
},
mentions: {
everyone: false,
users: {
},
roles: {
},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: {
},
repliedUser: null,
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: {
bitfield: 0,
},
reference: null,
interaction: null,
}
Embeds missing:
{
channelId: "984143582027972681",
guildId: "984143580241211412",
id: "1152294200927334420",
createdTimestamp: 1694798746092,
type: 0,
system: false,
content: "<@1080207865861644328> rolled stats...",
author: {
id: "261302296103747584",
bot: true,
system: false,
flags: {
bitfield: 65536,
},
username: "Avrae",
globalName: null,
discriminator: "6944",
avatar: "b4926b52f7f1c966e01e25f0b33253f1",
banner: null,
accentColor: null,
avatarDecoration: null,
},
pinned: false,
tts: false,
nonce: null,
embeds: [
],
components: [
],
attachments: {
},
stickers: {
},
position: null,
roleSubscriptionData: null,
editedTimestamp: null,
reactions: {
message: [Circular],
},
mentions: {
everyone: false,
users: {
},
roles: {
},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: {
},
repliedUser: null,
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: {
bitfield: 0,
},
reference: null,
interaction: null,
}
{
channelId: "984143582027972681",
guildId: "984143580241211412",
id: "1152294200927334420",
createdTimestamp: 1694798746092,
type: 0,
system: false,
content: "<@1080207865861644328> rolled stats...",
author: {
id: "261302296103747584",
bot: true,
system: false,
flags: {
bitfield: 65536,
},
username: "Avrae",
globalName: null,
discriminator: "6944",
avatar: "b4926b52f7f1c966e01e25f0b33253f1",
banner: null,
accentColor: null,
avatarDecoration: null,
},
pinned: false,
tts: false,
nonce: null,
embeds: [
],
components: [
],
attachments: {
},
stickers: {
},
position: null,
roleSubscriptionData: null,
editedTimestamp: null,
reactions: {
message: [Circular],
},
mentions: {
everyone: false,
users: {
},
roles: {
},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: {
},
repliedUser: null,
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: {
bitfield: 0,
},
reference: null,
interaction: null,
}
10 replies
SIASapphire - Imagine a framework
Created by WhacK on 9/3/2023 in #sapphire-support
Modal Validation String Primitive
I'm receiving an error when trying to display my modal. I've tried following the docs but may be missing something. I tried using this answer because it looks like the exact same issue but my modal does have a title. https://discord.com/channels/737141877803057244/1122637599933223002/1122759262716842006 Error: https://pastebin.com/vF6YKkMv Code: https://pastebin.com/GR0HnK44 Appreciate the help!
8 replies
SIASapphire - Imagine a framework
Created by WhacK on 2/19/2023 in #sapphire-support
Bot stalls while registering commands
My bot was working fine yesterday after noticing the new Cog section of the documentation (really cool thank you it worked perfectly.) After I changed to the cog system I noticed the updates to the packages in Announcements. I ran npm upgrade and started receiving the channel errors noted in another thread which I was able to fix. The bot now just stalls when registering commands, any idea what I can change? The registrations match the documentation as far as I can tell. Log: https://pastebin.com/BrPAYDa3 Package.json: https://pastebin.com/rRQyYjWA register snippet: https://pastebin.com/xeiryjk8 "COG"s implementation: https://pastebin.com/dtS487BH
28 replies
SIASapphire - Imagine a framework
Created by WhacK on 12/8/2022 in #sapphire-support
TypeError piece.aliases not iterable
When my bot is logging in, it is being prevented by this error below. I tried deleting my node_modules and reinstalling but the same thing happens. Obviously the error can't be in the framework, any idea how I can get past this? error:
2022-12-07 16:46:11 - ERROR - TypeError: piece.aliases is not iterable
2022-12-07 16:46:11 - ERROR - at CommandStore.insert (/Users/whacktop/Engrimoore/Beholder/node_modules/@sapphire/pieces/dist/lib/structures/AliasStore.js:58:33)
2022-12-07 16:46:11 - ERROR - at CommandStore.loadAll (/Users/whacktop/Engrimoore/Beholder/node_modules/@sapphire/pieces/dist/lib/structures/Store.js:139:24)
2022-12-07 16:46:11 - ERROR - at async CommandStore.loadAll (/Users/whacktop/Engrimoore/Beholder/node_modules/@sapphire/framework/dist/lib/structures/CommandStore.js:38:5)
2022-12-07 16:46:11 - ERROR - at async Promise.all (index 1)
2022-12-07 16:46:11 - ERROR - at async BeholderClient.login (/Users/whacktop/Engrimoore/Beholder/node_modules/@sapphire/framework/dist/lib/SapphireClient.js:65:5)
2022-12-07 16:46:11 - ERROR - TypeError: piece.aliases is not iterable
2022-12-07 16:46:11 - ERROR - at CommandStore.insert (/Users/whacktop/Engrimoore/Beholder/node_modules/@sapphire/pieces/dist/lib/structures/AliasStore.js:58:33)
2022-12-07 16:46:11 - ERROR - at CommandStore.loadAll (/Users/whacktop/Engrimoore/Beholder/node_modules/@sapphire/pieces/dist/lib/structures/Store.js:139:24)
2022-12-07 16:46:11 - ERROR - at async CommandStore.loadAll (/Users/whacktop/Engrimoore/Beholder/node_modules/@sapphire/framework/dist/lib/structures/CommandStore.js:38:5)
2022-12-07 16:46:11 - ERROR - at async Promise.all (index 1)
2022-12-07 16:46:11 - ERROR - at async BeholderClient.login (/Users/whacktop/Engrimoore/Beholder/node_modules/@sapphire/framework/dist/lib/SapphireClient.js:65:5)
package.json
{
"name": "beholder",
"version": "8.0.0",
"description": "A bot used to manage and interact with the D&D 5e Discord Server Engrimoore.",
"author": "Engrimoore Code Weavers",
"license": "Apache-2.0",
"main": "dist/beholder.js",
"private": true,
"type": "commonjs",
"dependencies": {
"@sapphire/decorators": "^5.0.0",
"@sapphire/discord-utilities": "^2.12.0",
"@sapphire/discord.js-utilities": "^5.1.2",
"@sapphire/fetch": "^2.4.1",
"@sapphire/framework": "^3.1.4",
"@sapphire/plugin-api": "next",
"@sapphire/plugin-editable-commands": "next",
"@sapphire/plugin-logger": "^3.0.1",
"@sapphire/plugin-subcommands": "next",
"@sapphire/time-utilities": "^1.7.8",
"@sapphire/type": "^2.2.6",
"@sapphire/utilities": "^3.11.0",
"@skyra/env-utilities": "^1.1.0",
"colorette": "^2.0.19",
"discord-api-types": "^0.33.5",
"discord.js": "^13.12.0",
"dotenv-cra": "^3.0.2",
"mongoose": "^6.7.5",
"reflect-metadata": "^0.1.13",
"@discordjs/builders": "^0.16.0",
"@sapphire/plugin-scheduled-tasks": "^6.0.0",
"@sapphire/snowflake": "^3.3.0",
"@sapphire/stopwatch": "^1.5.0",
"ws": "^8.11.0"
},
"devDependencies": {
"@sapphire/prettier-config": "^1.4.4",
"@sapphire/ts-config": "^3.3.4",
"@types/node": "^18.11.10",
"@types/ws": "^8.5.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.0",
"tsc-watch": "^5.0.3",
"typescript": "^4.9.3"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"start": "node dist/beholder.js",
"dev": "run-s build start",
"watch:start": "tsc-watch --onSuccess \"node ./dist/beholder.js\"",
"format": "prettier --write \"src/**/*.ts\""
},
"prettier": "@sapphire/prettier-config"
}
{
"name": "beholder",
"version": "8.0.0",
"description": "A bot used to manage and interact with the D&D 5e Discord Server Engrimoore.",
"author": "Engrimoore Code Weavers",
"license": "Apache-2.0",
"main": "dist/beholder.js",
"private": true,
"type": "commonjs",
"dependencies": {
"@sapphire/decorators": "^5.0.0",
"@sapphire/discord-utilities": "^2.12.0",
"@sapphire/discord.js-utilities": "^5.1.2",
"@sapphire/fetch": "^2.4.1",
"@sapphire/framework": "^3.1.4",
"@sapphire/plugin-api": "next",
"@sapphire/plugin-editable-commands": "next",
"@sapphire/plugin-logger": "^3.0.1",
"@sapphire/plugin-subcommands": "next",
"@sapphire/time-utilities": "^1.7.8",
"@sapphire/type": "^2.2.6",
"@sapphire/utilities": "^3.11.0",
"@skyra/env-utilities": "^1.1.0",
"colorette": "^2.0.19",
"discord-api-types": "^0.33.5",
"discord.js": "^13.12.0",
"dotenv-cra": "^3.0.2",
"mongoose": "^6.7.5",
"reflect-metadata": "^0.1.13",
"@discordjs/builders": "^0.16.0",
"@sapphire/plugin-scheduled-tasks": "^6.0.0",
"@sapphire/snowflake": "^3.3.0",
"@sapphire/stopwatch": "^1.5.0",
"ws": "^8.11.0"
},
"devDependencies": {
"@sapphire/prettier-config": "^1.4.4",
"@sapphire/ts-config": "^3.3.4",
"@types/node": "^18.11.10",
"@types/ws": "^8.5.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.0",
"tsc-watch": "^5.0.3",
"typescript": "^4.9.3"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"start": "node dist/beholder.js",
"dev": "run-s build start",
"watch:start": "tsc-watch --onSuccess \"node ./dist/beholder.js\"",
"format": "prettier --write \"src/**/*.ts\""
},
"prettier": "@sapphire/prettier-config"
}
22 replies