how to fix operator '==' is ambiguous on operands of type ulong and long

后端 未结 3 1315
长情又很酷
长情又很酷 2021-01-27 13:36

I\'m currently building a new command in my Discord Server and i\'m struggling to convert the UserId back to the Users Nickname in my server.

i am getting error message

3条回答
  •  闹比i
    闹比i (楼主)
    2021-01-27 14:15

    Try casting memberId to a ulong (or UInt64) so the type matches x.Id:

    var memberId = (ulong)reader.GetInt64(0);
    string name = Context.Guild.Users
        .Where(x => x.Id == memberId)
        ...
        ...
    

    Also, you have a few other things to fix as the other answer and comments suggest. ;)

提交回复
热议问题