Certain amount of infractions per page
This is how I get a list of warnings of the provided user, my question is, how can I make it so there's pages with certain amount of infractions shown in each page? I'm using PaginatedMessages from
@sapphire/discord.js-utilities
21 Replies
wdym? like limit the amount of fields in a page?
if so, there should be a
setItemsPerPage
function
like <new PaginatedMessageEmbedFields>.setItemsPerPage(10)
[ERROR] Encountered error on message command "warnings" at path "C:\Users\cmart\Desktop\Discord Bots\Sapphire\src\commands\Moderation\warnings.js" TypeError: Cannot read properties of undefined (reading 'title')
Code: https://pastebin.com/mr57SHTdPastebin
Paginated Messages - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
oh and it says .setItemsPerPage is not a function
PaginatedMessage and PaginatedMessageEmbedFields are different classes
Rather the second extends the first
ah alright
what about this error
[ERROR] Encountered error on message command "warnings" at path "C:\Users\cmart\Desktop\Discord Bots\Sapphire\src\commands\Moderation\warnings.js" TypeError: Cannot read properties of undefined (reading 'title')
wait hold up
I think I got it
how do I set an author icon
[ERROR] Encountered error on message command "warnings" at path "C:\Users\cmart\Desktop\Discord Bots\Sapphire\src\commands\Moderation\warnings.js" DiscordAPIError[50035]: Invalid Form Body
embeds[0].author[MODEL_TYPE_CONVERT]: Expected an object/dictionary.
embeds[0].color[NUMBER_TYPE_COERCE]: Value "#2f3136" is not int.
.author needs to be an object matching APIEmbedAuthor: https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmbedAuthor
Or do the sensible thing and use
EmbedBuilder
:
(also I know you write JS but I implore you to consider switching to TS because it would've warned you that that is invalid code before you ran it)discord-api-types documentation
discord-api-types - Imagine typings
discord-api-types is a simple Node/Deno module that brings up to date typings for Discord's API
i was going to switch to ts like a week ago but got too lazy
anyways ty
I have a few questions:
Why color doesn't accept hex codes?
How to edit the footer
How to remove the select menus
oh and is there a way to change from which page the list starts?
I want users to be able to do >warnings [page]
Why color doesn't accept hex codes?https://discord.js.org/docs/packages/builders/1.7.0/EmbedBuilder:Class#setColor. Strings were removed in either DJS v13 or v14, I forgot which. Change it to FYI this counts for ALL embeds with DiscordJS, NOT just PaginatedMessage
How to edit the footerSet the footer in the template. You can remove the page index bit with https://www.sapphirejs.dev/docs/Documentation/api-utilities/classes/sapphire_discord_js_utilities.PaginatedMessage#setshouldaddfootertoembeds
How to remove the select menusOverride the actions, search this forum/server for examples. There are many. Just search for "actions". The short version is filtering it out of
PaginatedMessage.defaultActions
oh and is there a way to change from which page the list starts?No, but you can remark it in #paginated-messages-v2 for the future as a request.
I actually wanted to add text before the page index, not after
ah no that's not possible
oh alright
what text if I might ask?
wondering why it cant be behind
just wanted to add Page so it looks like Page 1 / 1
but it doesn't matter that much
you can do that by setting the
pageIndexPrefix
in the constructor
or set PaginatedMesasge.pageIndexPrefix
in your entrypoint to apply it to all PaginatedMessage
instancesalright thanks
TypeError: (intermediate value).pageIndexPrefix is not a function
read carefully what I said
ah
.
am I using
setWrongUserInteractionReply
correctly? Looks like it's not working
and is there a way to make the .run ephemeral?
On the docs it says wrongUserInteractionReply
but on my auto complete is says setWrongUserInteractionReply
btwthe one is the property, the other the method
and to make it ephemeral first defer the reply with ephemeral
alright ty
sorry for re-opening an old post, but what's the name of that color format?
Hexadecimal