SocketChannel DiscordSocketClient.GetChannel(id) returns null 给定正确的频道ID

SocketChannel DiscordSocketClient.GetChannel(id) returns null with correct channel's id given

如题。即使通道的 id 正确,Var 通道仍然为 null。

public class MyRegistry : Registry
    {
        public class Task : ModuleBase
        {
            public Task()
            {
                var channel = CommandHandler._discord.GetChannel(CHANNELS_ID);
                IMessageChannel chnl = channel as IMessageChannel;
                JobManager.AddJob(() => chnl.SendMessageAsync("test"), (s) => s.ToRunEvery(3).Seconds());
            }
        }
        static void Initializer()
        {
            JobManager.Initialize(new MyRegistry());
        }
    }

我也试过:

var channel = CommandHandler._discord.GetGuild(SERVERS_ID).GetChannel(CHANNELS_ID);

但它仍然是空的,即使有有效的 ulogs。 应该如何申诉到指定频道?

我不知道为什么,但跳过 SocketChannel 和 IMessageChannel 声明有效:

public class MyRegistry : Registry
    {
        public class Task : ModuleBase
        {
            public Task()
            {
                JobManager.AddJob(() => (CommandHandler._discord.GetChannel(CHANNELS_ID) as IMessageChannel).SendMessageAsync("test"), (s) => s.ToRunEvery(3).Seconds());
            }
        }
        static void Initializer()
        {
            JobManager.Initialize(new MyRegistry());
        }
    }