I'm trying to add a dice command to my discord bot
It works perfectly if I do not specify the range -> rand.Next()
However, when I add a range (1,7), it keeps showing "Exception: ArgumentOutOfRangeException"
.Do(async (e) =>
Random rand = new Random();
int num = rand.Next(1,7);
string s = Convert.ToString(num);
I don't see any problem with your arguments or your syntax. I check it like five times lol.
How about try putting the Random rand = new Random(); out of the function (I'm guessing the async setting is the one causing the problem) or better yet generate the random number outside async if possible.