Currently working on gambling bot of sorts, i'm still relatively new to discord API and this problem is driving me insane.
[Command("ping")]
public async Task PingUser(IUser user)
{
Console.WriteLine(user.Username + " " + user.Id);
}
Using this command for some reason sometimes doesn't find the user, other times it works just fine, however if the user who wasn't found before typed something in the chat, the same command would then work as intended.
Similarly, running the following code throws an error:
Object reference not set to an instance of an object.
The Users list is taken from a sqlite file where I store the users' ID, balance, etc. I assume it's the same problem because GetUser method for some reason can't find the user.
for (int i = 0; i < Users.Count; i++)
{
var user = Context.Guild.GetUser(Users[i].Id);
print += $"{i + 1}. {user.Username} {Users[i].Balance} Baps\n";
if (i == 9)
break;
}
Any ideas?