mcdiscordbot/MinecraftDiscordBot/Message.cs

21 lines
596 B
C#
Raw Normal View History

2022-01-10 16:10:32 +01:00
using Discord.WebSocket;
using Newtonsoft.Json;
namespace MinecraftDiscordBot;
public abstract class Message {
[JsonProperty("type")]
public abstract string Type { get; }
}
public class TextMessage : Message {
public TextMessage(SocketMessage arg) : this(arg.Author.Username, arg.Content) { }
public TextMessage(string author, string content) {
Author = author;
Content = content;
}
public override string Type => "text";
[JsonProperty("author")]
public string Author { get; }
[JsonProperty("message")]
public string Content { get; }
}