当用户点击反应时,我无法发出角色

I can't issue a role when the user clicks on reaction

如您所见,如果您删除发出代码的代码,当用户点击反应时,它会被计分并以用户名的形式作为响应出现。因为我在程序中写了这个方法并添加了遗留的 ModuleBase 它是有限的,我将不得不 return null,我总是在所需 class 的参数中解决这个问题,但现在我不能添加超过 3 个 classes,因为 ReactionAdded 字段需要 3 个参数,为了反应,请告诉我方法内部如何使用 classes SocketGuild、SocketGuildUser 和 Yes 角色变量 return s 为空,因为 ModuleBase

 [Command("react")]
        public async Task HandleReaction()
        {
            RestUserMessage message = await Context.Channel.SendMessageAsync("react");
            Program.MessageId = message.Id;
        }

internal static ulong MessageId { get; set; }
  public  ITextChannel textChannel;

    public SocketGuildUser user;    

private async Task OnReactionAdd(Cacheable<IUserMessage, ulong> cache, ISocketMessageChannel channel, SocketReaction reaction)
        {
          
            if (reaction.MessageId == Program.MessageId)
            {
                  if (reaction.Emote.Name == "")
            {
                

                ulong roleid = 747992707351183541;
                var role = textChannel.Guild.GetRole(roleid); //System.NullReferenceException: "Object reference not set to an instance of an object."

                await user.AddRoleAsync(role);
                await channel.SendMessageAsync(reaction.User.Value.Username);
            }
            }
        }
private async Task OnReactionAdd(Cacheable<IUserMessage, ulong> cache, ISocketMessageChannel channel, SocketReaction reaction)
{  
    if (reaction.MessageId == Program.MessageId)
    {
        if (reaction.Emote.Name == "")
        {
            ulong roleid = 747992707351183541;
            //here can cast the ISocketMessageChannel to an ITextChannel
            if (channel is SocketTextChannel textChannel) 
            {
                var role = textChannel.Guild.GetRole(roleid); 
                var user = textChannel.Guild.GetUser(reaction.UserId);
                
                await user.AddRoleAsync(role);
                await textChannel.SendMessageAsync(user.Username);
            }   
        }
    }    
}