Ryze
Ryze
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
Oh, how uneducated i am
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
Isnt dynamic a faster option ?
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
Will try thanks
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
idk how i didnt notice that
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
thank you so much
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
im so stupid
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
dude
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
oh
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
await Task.Delay(finalDelay * 1000) is the main wait, *1000 is so it is counted in seconds.
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
Ill do that sorry
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
Thats just a small delay before the iteration happend, thats supposed to be like that. Incase something happens and it needs that, really I just put it there to see if it would work
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
But it instantly sends
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
It tells me the correct base delay
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
this is what debugging tells me: Index: 0, Delay: 3 Message sent successfully from ryze07 reached task.delay
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
What I don't understand is why the heck the first iteration wont wait the set delay
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
I am a beginnering and I am trying to learn by doing. This will not be used for discord but rather for educational purposes only.
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
this is for learning purposes and I do not condone using user tokens and requesting HTTP via discord api
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
c#
if (index != 0)
{
Console.WriteLine("Hello");
finalDelay += tokenDelay * index;
}

Console.WriteLine($"Index: {index}, Delay: {finalDelay}");

using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", token);

HttpResponseMessage infoResponse = await client.GetAsync("https://discord.com/api/v10/users/@me");

string url = $"https://discord.com/api/v10/channels/{channelID}/messages";

var content = new StringContent($"{{\"content\": \"{message}\"}}", Encoding.UTF8, "application/json");

var response = await client.PostAsync(url, content);

if (response.IsSuccessStatusCode)
{
if (infoResponse.IsSuccessStatusCode)
{
string userInfo = await infoResponse.Content.ReadAsStringAsync();
dynamic information = JsonConvert.DeserializeObject(userInfo);

username = information.username;

Console.WriteLine($"Message sent successfully from {username}");
}
}
else
{
Console.WriteLine($"Failed to send message: {response.StatusCode}");
}


Console.WriteLine("reached task.delay");
await Task.Delay(finalDelay * 1000);
}
index++;
}
index = 0;
}

}
c#
if (index != 0)
{
Console.WriteLine("Hello");
finalDelay += tokenDelay * index;
}

Console.WriteLine($"Index: {index}, Delay: {finalDelay}");

using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", token);

HttpResponseMessage infoResponse = await client.GetAsync("https://discord.com/api/v10/users/@me");

string url = $"https://discord.com/api/v10/channels/{channelID}/messages";

var content = new StringContent($"{{\"content\": \"{message}\"}}", Encoding.UTF8, "application/json");

var response = await client.PostAsync(url, content);

if (response.IsSuccessStatusCode)
{
if (infoResponse.IsSuccessStatusCode)
{
string userInfo = await infoResponse.Content.ReadAsStringAsync();
dynamic information = JsonConvert.DeserializeObject(userInfo);

username = information.username;

Console.WriteLine($"Message sent successfully from {username}");
}
}
else
{
Console.WriteLine($"Failed to send message: {response.StatusCode}");
}


Console.WriteLine("reached task.delay");
await Task.Delay(finalDelay * 1000);
}
index++;
}
index = 0;
}

}
33 replies
CC#
Created by Ryze on 3/10/2025 in #help
Problem with the first iteration in the loop, wont wait the set delay
c#
if (Tokens.Count > 1)
{
Console.WriteLine("It seems as if you have more than 1 token stored, would you like to have a message delay on each token?");
Console.Write("Y/N: ");
char answer = char.ToUpper(Console.ReadKey().KeyChar);
Console.WriteLine();

if (answer == 'Y')
{
int index = 0;
Console.Write("What delay would you like between each token? Write in seconds: ");
int tokenDelay = Convert.ToInt32(Console.ReadLine());
while (true)
{

if (backgroundWorker.CancellationPending)
{
break;
}

foreach (string token in Tokens)
{

await Task.Delay(100);
int finalDelay = delay;
c#
if (Tokens.Count > 1)
{
Console.WriteLine("It seems as if you have more than 1 token stored, would you like to have a message delay on each token?");
Console.Write("Y/N: ");
char answer = char.ToUpper(Console.ReadKey().KeyChar);
Console.WriteLine();

if (answer == 'Y')
{
int index = 0;
Console.Write("What delay would you like between each token? Write in seconds: ");
int tokenDelay = Convert.ToInt32(Console.ReadLine());
while (true)
{

if (backgroundWorker.CancellationPending)
{
break;
}

foreach (string token in Tokens)
{

await Task.Delay(100);
int finalDelay = delay;
33 replies
CC#
Created by Ryze on 3/9/2025 in #help
Why wont it reach return?
thanks for the help i really appreciate it
59 replies