Another problem with making a discord bot

  • Thread starter Thread starter Smashy77
  • Start date Start date
S

Smashy77

Guest
I was planning to write another syntax for my bot and I got this kind of error: "Severity Code Description Project File Line Suppression State
Error CS1501 No overload for method 'ExecuteAsync' takes 2 arguments Bot C:\Users\user\source\repos\Botl\Botl\Program.cs 64 Active" for line 64

Would you please help me? Thanks in advance.

Also... this is the code program:

using System;
using System.Reflection;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
namespace Bot
{
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.AddModulesAsync(assembly: Assembly.GetEntryAssembly(), services: null);
Client.Ready += Client_Ready;
Client.Log += Client_Log;
await Client.LoginAsync(TokenType.Bot, "");
await Client.StartAsync();
await Task.Delay(-1);
}
private async Task Client_Log(LogMessage Message)
{
Console.WriteLine($"{DateTime.Now} at {Message.Source}] {Message.Message}");
}
private async Task Client_Ready()
{
await Client.SetGameAsync("ur dad", "");
}
private async Task Client_MessageReceived(SocketMessage MessageParam)
{
var Message = MessageParam as SocketUserMessage;
var Context = new SocketCommandContext(Client, Message);
if (Context.Message == null || Context.Message.Content == "") return;
if (Context.User.IsBot) return;
int ArgPos = 0;
if (!(Message.HasStringPrefix("gay!", ref ArgPos) || Message.HasMentionPrefix(Client.CurrentUser, ref ArgPos))) return;
var Result = await Commands.ExecuteAsync(Context, ArgPos);
if (!Result.IsSucces)
{
Console.WriteLine($"{DateTime.Now} at Commands] Something went wrong with executing a command. Text: {Context.Message.Content} | Error: {Result.ErrorReason}");
}
}
}
}

Continue reading...
 

Similar threads

Back
Top