almost done, queue fix next
This commit is contained in:
33
sim.go
33
sim.go
@@ -34,23 +34,24 @@ type GatewayAck struct {
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type MinecraftUser struct {
|
||||
type User struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type Destination struct {
|
||||
ChannelID string `json:"channel_id"`
|
||||
ID string `json:"channel_id,omitempty"`
|
||||
}
|
||||
|
||||
type GatewayModMessageIn struct {
|
||||
MsgID string `json:"msg_id"`
|
||||
Server string `json:"server"`
|
||||
Destination Destination `json:"destination"`
|
||||
Author MinecraftUser `json:"author"`
|
||||
Content string `json:"content"`
|
||||
Meta map[string]interface{} `json:"meta,omitempty"`
|
||||
Ts string `json:"ts,omitempty"`
|
||||
type GatewayMessageIn struct {
|
||||
ID string `json:"id"` // where am I from (channel_id or server_id)
|
||||
MsgID string `json:"msg_id"` // msg id
|
||||
Destination Destination `json:"destination,omitempty"` // where do I wanna go (channel_id or empty if from Bot)
|
||||
Author User `json:"author"` // who sent the message
|
||||
Content string `json:"content"` // message content
|
||||
Meta map[string]interface{} `json:"meta,omitempty"` // additional metadata
|
||||
Ts time.Time `json:"ts,omitempty"` // timestamp
|
||||
ReceivedAt time.Time `json:"-"` // ReceivedAt is populated by gateway (not from mod)
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -140,18 +141,18 @@ func main() {
|
||||
|
||||
// Optional: Send a test message after connecting
|
||||
time.Sleep(2 * time.Second)
|
||||
testMsg := GatewayModMessageIn{
|
||||
MsgID: "test-msg-001",
|
||||
Server: serverID,
|
||||
testMsg := GatewayMessageIn{
|
||||
MsgID: "test-msg-001",
|
||||
ID: serverID,
|
||||
Destination: Destination{
|
||||
ChannelID: "123456789",
|
||||
ID: "123456789",
|
||||
},
|
||||
Author: MinecraftUser{
|
||||
Author: User{
|
||||
ID: "player-uuid-123",
|
||||
Name: "TestPlayer",
|
||||
},
|
||||
Content: "Hello from simulated mod!",
|
||||
Ts: time.Now().UTC().Format(time.RFC3339),
|
||||
Ts: time.Now().UTC(),
|
||||
}
|
||||
|
||||
if err := conn.WriteJSON(testMsg); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user