diff options
| author | Kyren223 <ulmliad223@gmail.com> | 2024-10-24 16:39:14 +0300 |
|---|---|---|
| committer | Kyren223 <ulmliad223@gmail.com> | 2024-10-24 16:39:14 +0300 |
| commit | 688668f6d34d4d962247bd5df60c3fca61185927 (patch) | |
| tree | 459a29a76bb3a8cd77cdeccf35d7c1689374d09d /internal/data/chat.go | |
| parent | 6f83f199f8311bf7782da59bc2e07df38073e65a (diff) | |
feat: worked on client
Diffstat (limited to 'internal/data/chat.go')
| -rw-r--r-- | internal/data/chat.go | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/internal/data/chat.go b/internal/data/chat.go index 9d2443d..ae5dc67 100644 --- a/internal/data/chat.go +++ b/internal/data/chat.go @@ -1,6 +1,9 @@ package data -import "github.com/kyren223/eko/pkg/snowflake" +import ( + "github.com/kyren223/eko/pkg/snowflake" + "github.com/kyren223/eko/pkg/utils" +) // Represents an Eko Network, equivalent to a "discord server". type Network struct { @@ -23,11 +26,27 @@ type Signal struct { // Represents a message type Message struct { - Id snowflake.ID - SenderId snowflake.ID + Id snowflake.ID + SenderId snowflake.ID FrequencyId snowflake.ID - NetworkId snowflake.ID - Contents string + NetworkId snowflake.ID + Contents string +} + +func (a Message) CmpTimestamp(b Message) int { + cmpTime := a.Id.Time() - b.Id.Time() + if cmpTime != 0 { + return int(utils.Clamp(cmpTime, -1, 1)) + } + cmpStep := a.Id.Step() - b.Id.Step() + if cmpStep != 0 { + return int(utils.Clamp(cmpStep, -1, 1)) + } + cmpNode := a.Id.Node() - b.Id.Node() + if cmpNode != 0 { + return int(utils.Clamp(cmpNode, -1, 1)) + } + return 0 } // Represents an Eko User |
