set limits on reply length and use updated commandinterfacecaller
This commit is contained in:
parent
61c45e9e79
commit
34cacefdc7
1 changed files with 17 additions and 2 deletions
|
|
@ -164,6 +164,10 @@ namespace SecondBotEvents.Services
|
||||||
|
|
||||||
protected void ReplyToMessage(IMessage message, string reply)
|
protected void ReplyToMessage(IMessage message, string reply)
|
||||||
{
|
{
|
||||||
|
if(reply.Length > 2000)
|
||||||
|
{
|
||||||
|
reply = reply.Substring(0, 1900)+"...";
|
||||||
|
}
|
||||||
message.Channel.SendMessageAsync(reply, false, null, null, null, new MessageReference(message.Id));
|
message.Channel.SendMessageAsync(reply, false, null, null, null, new MessageReference(message.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,6 +282,18 @@ namespace SecondBotEvents.Services
|
||||||
_ = message.DeleteAsync();
|
_ = message.DeleteAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void RunCommandFromChat(SocketMessage message)
|
||||||
|
{
|
||||||
|
KeyValuePair<bool, string> reply = master.CommandsService.CommandInterfaceCaller(message.Content, false, false, "DiscordAPI");
|
||||||
|
string replyEmote = "✅";
|
||||||
|
if (reply.Key == false)
|
||||||
|
{
|
||||||
|
replyEmote = "❌";
|
||||||
|
}
|
||||||
|
_ = MarkMessage((IUserMessage)message, replyEmote);
|
||||||
|
ReplyToMessage(message, reply.Value);
|
||||||
|
}
|
||||||
|
|
||||||
protected void RunCommandFromMessage(SignedCommand C, SocketMessage message)
|
protected void RunCommandFromMessage(SignedCommand C, SocketMessage message)
|
||||||
{
|
{
|
||||||
KeyValuePair<bool, string> reply = master.CommandsService.RunCommand(C);
|
KeyValuePair<bool, string> reply = master.CommandsService.RunCommand(C);
|
||||||
|
|
@ -366,8 +382,7 @@ namespace SecondBotEvents.Services
|
||||||
if (message.Author.Id != DiscordClient.CurrentUser.Id)
|
if (message.Author.Id != DiscordClient.CurrentUser.Id)
|
||||||
{
|
{
|
||||||
// do command
|
// do command
|
||||||
RunCommandFromMessage(new SignedCommand(master.CommandsService,
|
RunCommandFromChat(message);
|
||||||
"discordapi", message.Content, false, false, 0, ""), message);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue