#waiting for interaction stops at the first person who use the commands when someone either use it
1 messages · Page 1 of 1 (latest)
Interactivity is a wrapper for event handlers, and thusly should not be used within an event handler.
and what i should do ?
Hello can we look at your code?
for sure
oh waffen
i still use
the ctx.Client.ComponentInteractionCreated += async (s, e) =>
that you told me you shouldn't use it
Ok, in last time you didn't give you custom pagination class and i have tested version that was just showing numbers.
Let's try to fix your whole code together.
Can i look at your whole code?
"C:\Users\Discord\Files\list.txt" can i also get this file for test?
oh my bad here is it
First:
static async Task MainAsync()
{
var discord = new DiscordClient(new DiscordConfiguration()
{
Token = "",
TokenType = TokenType.Bot,
Intents = DiscordIntents.All
});
var commands = discord.UseCommandsNext(new CommandsNextConfiguration()
{
StringPrefixes = new[] { "!" }
});
commands.RegisterCommands(Assembly.GetExecutingAssembly());
discord.ComponentInteractionCreated += ClientOnInteractionCreated; // <--- here what i told about handling InteractionCreated
commands.CommandErrored += (s, e) =>
{
Console.WriteLine(e.Exception.ToString(), e);
return Task.CompletedTask;
};
await discord.ConnectAsync();
await Task.Delay(-1);
}
public static async Task ClientOnInteractionCreated(DiscordClient client, ComponentInteractionCreateEventArgs args)
{
switch (args.Id)
{
case "lastPage":
{
// code here...
break;
}
case "NexPage":
{
// code here...
break;
}
}
}
that was i think
could pleas explain how switch works ? @stuck fiber
one more thing is this gonna make it for interaction for ever ?
args.Id - it is you CustomId
You want to switch between values of this Custom Id switch (args.Id)
You can use case without {} like
case "1":
// code
break;
case "2"
// code again
break;
...
break must be in each case. But if don't use { } you can't use same variables
case "1":
var line = 1;
// code
break;
case "2"
// code again
var line = 2 // error - because you have declared it before
break;
...
{ } will fix it
More about switch case: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/selection-statements
Also you can just use if else it could work too
thank you a lot @stuck fiber
Is this what you expect to see in the work of your bot?
It is possible to change buttons, and make hyperlinks much better but like i've said it is fast video example
yeah it works from ethier the problems if someone else use same command the list stop wrok for first user
let me show u ...
It is possible to make message like: "You can't use not your own list"
If we forget about Interactions and else, in first your ticket in support (iirc) i've said you about DsharpPlus.Interactivity and it has his own pagination system
it's ok 👌
in this vedio you used PaginationCommand ?
could you share them :)

i spend my hole life wondring how to make this shit work (im new to this stuff )
can we just open live share in vs ?
I can't spoon feed you here sorry. This code is same like in an example with emojies
Try it
lemm try it
If you get problems with it i will help
i set it to true
Did it fix interaction failure?
yeah
and im stupid as fuck
Timeout= TimeSpan.FromSeconds(5),
this blocks the intreaction
if you need infinity interaction just set it ti 99999, i don't know how to do it cleaner
just done call it make infi i guess
Try it
I am not using DsharpPlus.Interactivity in my projects
So i don't know many about this extension
anyway is there a way to customize the Pagination?
yes
Because pagination put selected text in first page
i will make when bot add item put "\n" betwen every new itme
Sometimes you need just look at the problem from a new angle
And the problem becomes very simple
for real
You are welcome
i didnt think they have a ready function to do this
instead of my 60 stupid one
is the way that i make it good ?
im taling abt list
it was interesting method, but too hard for this task ;)
