Krispy
Krispy
CC#
Created by Krispy on 10/27/2022 in #help
Bot not working?
yes, but I solved it a friend helped thank you. Had to add a few extra lines of some things
8 replies
CC#
Created by Krispy on 10/27/2022 in #help
Bot not working?
8 replies
CC#
Created by Krispy on 10/27/2022 in #help
Bot not working?
Followed a simple tutorial on YT on how to set up a C# bot, idk why when I do !ping it does not return pong like it should
8 replies
CC#
Created by Krispy on 10/27/2022 in #help
Bot not working?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Commands;

namespace BotTesting.Modules
{
public class Commands : ModuleBase<SocketCommandContext>
{
[Command("ping")]
public async Task Ping()
{
await ReplyAsync("Pong");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Commands;

namespace BotTesting.Modules
{
public class Commands : ModuleBase<SocketCommandContext>
{
[Command("ping")]
public async Task Ping()
{
await ReplyAsync("Pong");
}
}
}
8 replies
CC#
Created by Krispy on 10/27/2022 in #help
Bot not working?
private async Task HandleCommandAsync(SocketMessage arg)
{
var message = arg as SocketUserMessage;
var context = new SocketCommandContext(_client, message);
{
if (message.Author.IsBot) return;

int argPos = 0;
if (message.HasStringPrefix("!", ref argPos))
{
var result = await _commands.ExecuteAsync(context, argPos, _services);
if (!result.IsSuccess) Console.WriteLine(result.ErrorReason);
}
}
}
}
}
private async Task HandleCommandAsync(SocketMessage arg)
{
var message = arg as SocketUserMessage;
var context = new SocketCommandContext(_client, message);
{
if (message.Author.IsBot) return;

int argPos = 0;
if (message.HasStringPrefix("!", ref argPos))
{
var result = await _commands.ExecuteAsync(context, argPos, _services);
if (!result.IsSuccess) Console.WriteLine(result.ErrorReason);
}
}
}
}
}
8 replies
CC#
Created by Krispy on 10/26/2022 in #help
How to change message?
works ty
7 replies