CS1503 C#参数1:无法转换为' System.Reflection.Assembly'到' System.Type'

时间:2018-06-16 14:17:24

标签: c#

我尝试制作不和谐机器人,但我收到了这个错误:

  

CS1503 C#参数1:无法转换为' System.Reflection.Assembly'到' System.Type'。

我想创建一个不和谐机器人,但由于这个错误,我无法运行它。

Here is photo of my visual studio

我的代码:

using System;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;

using Discord;
using Discord.Commands;
using Discord.WebSocket;

namespace Risk
{
    class Program
    {
        private DiscordSocketClient Client;
        private CommandService Commands;

        static void Main(string[] args)
            => new Program().MainAsync().GetAwaiter().GetResult();

        private async Task MainAsync()
        {
            Client = new DiscordSocketClient(new DiscordSocketConfig
            {
                LogLevel = LogSeverity.Debug
            });


            Commands = new CommandService(new CommandServiceConfig
            {
                CaseSensitiveCommands = true,
                DefaultRunMode = RunMode.Async,
                LogLevel = LogSeverity.Debug
            });

            Client.MessageReceived += Client_MessageReceived;
            await Commands.AddModuleAsync(Assembly.GetEntryAssembly());

            Client.Ready += Client_Ready;
            Client.Log += Client_Log;

            string Token = "";
            using (var Stream = new FileStream((Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)).Replace(@"bin\Debug\netcoreapp2.0", @"Data\Token.txt"), FileMode.Open, FileAccess.Read))
            using (var ReadToken = new StreamReader(Stream))
            {
                Token = ReadToken.ReadToEnd();
            }

            await Client.LoginAsync(TokenType.Bot, Token);
            await Client.StartAsync();

            await Task.Delay(-1);
        }

        private async Task Client_Log(LogMessage arg)
        {
            Console.WriteLine($"{DateTime.Now} at (Message.Source)] (Message.Message)");
        }

        private async Task Client_Ready()
        {
            await Client.SetGameAsync("Risk Bot...", "", StreamType.NotStreaming);
        }

        private async Task Client_MessageReceived(SocketMessage arg)
        {

        }
    }
}

1 个答案:

答案 0 :(得分:0)

为什么期望df = pd.DataFrame(np.random.rand(4,5), columns = list('abcde')) df['a'][2:]=1 df['a'][:2]=2 a3d = np.array(list(df.groupby('a').apply(pd.DataFrame.as_matrix))) a3d.shape (2,2,5) 时通过Assembly? 只需将Type重命名为AddModuleAsync就可以了。 抱歉,我没有源代码来确保它确实有效,但是应该可以。