client revamping
This commit is contained in:
parent
c928aa323a
commit
27b934dadc
6
def.go
6
def.go
@ -19,8 +19,8 @@ type TGCommand struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ChatWarsMessage struct {
|
type ChatWarsMessage struct {
|
||||||
UserID64 int64 `json:"user_id"`
|
TGUserID64 int64 `json:"tg_user_id"`
|
||||||
SenderUserID64 int64 `json:"sender_user_id"`
|
TGSenderUserID64 int64 `json:"tg_sender_user_id"`
|
||||||
Date time.Time `json:"date"`
|
Date time.Time `json:"date"`
|
||||||
ID64 int64 `json:"id"`
|
ID64 int64 `json:"id"`
|
||||||
ChatID64 int64 `json:"chat_id"`
|
ChatID64 int64 `json:"chat_id"`
|
||||||
@ -28,7 +28,7 @@ type ChatWarsMessage struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MQKeepAlive struct {
|
type MQKeepAlive struct {
|
||||||
UserID64 int64 `json:"user_id"`
|
TGUserID64 int64 `json:"tg_user_id"`
|
||||||
Nickname string `json:"nick"`
|
Nickname string `json:"nick"`
|
||||||
Queue string `json:"queue"`
|
Queue string `json:"queue"`
|
||||||
Date time.Time `json:"date"`
|
Date time.Time `json:"date"`
|
||||||
|
2
mq.go
2
mq.go
@ -116,7 +116,7 @@ func MQKeepAliveWorker() {
|
|||||||
for true {
|
for true {
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
m := MQKeepAlive{
|
m := MQKeepAlive{
|
||||||
UserID64: ownUserID64,
|
TGUserID64: ownUserID64,
|
||||||
Nickname: cfg.Rabbit.User,
|
Nickname: cfg.Rabbit.User,
|
||||||
Queue: cfg.Rabbit.ReceiveQueue,
|
Queue: cfg.Rabbit.ReceiveQueue,
|
||||||
Date: t,
|
Date: t,
|
||||||
|
16
td.go
16
td.go
@ -52,8 +52,8 @@ func ListenMQ(c *tdlib.Client, msgs <-chan TGCommand) {
|
|||||||
txt := u.Content.(*tdlib.MessageText).Text.Text
|
txt := u.Content.(*tdlib.MessageText).Text.Text
|
||||||
|
|
||||||
r := ChatWarsMessage{
|
r := ChatWarsMessage{
|
||||||
UserID64: ownUserID64,
|
TGUserID64: ownUserID64,
|
||||||
SenderUserID64: int64(u.SenderUserID),
|
TGSenderUserID64: int64(u.SenderUserID),
|
||||||
ID64: u.ID,
|
ID64: u.ID,
|
||||||
ChatID64: u.ChatID,
|
ChatID64: u.ChatID,
|
||||||
Text: txt,
|
Text: txt,
|
||||||
@ -93,8 +93,8 @@ func ListenCW(c *tdlib.Client) {
|
|||||||
t := time.Now()
|
t := time.Now()
|
||||||
|
|
||||||
m := ChatWarsMessage{
|
m := ChatWarsMessage{
|
||||||
UserID64: ownUserID64,
|
TGUserID64: ownUserID64,
|
||||||
SenderUserID64: int64(updateMsg.Message.SenderUserID),
|
TgSenderUserID64: int64(updateMsg.Message.SenderUserID),
|
||||||
ID64: updateMsg.Message.ID,
|
ID64: updateMsg.Message.ID,
|
||||||
ChatID64: updateMsg.Message.ChatID,
|
ChatID64: updateMsg.Message.ChatID,
|
||||||
Text: txt,
|
Text: txt,
|
||||||
@ -166,8 +166,8 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
|
|||||||
case tdlib.MessageTextType:
|
case tdlib.MessageTextType:
|
||||||
if msg.ForwardInfo == nil {
|
if msg.ForwardInfo == nil {
|
||||||
m = ChatWarsMessage{
|
m = ChatWarsMessage{
|
||||||
UserID64: ownUserID64,
|
TGUserID64: ownUserID64,
|
||||||
SenderUserID64: int64(msg.SenderUserID),
|
TGSenderUserID64: int64(msg.SenderUserID),
|
||||||
ID64: msg.ID,
|
ID64: msg.ID,
|
||||||
ChatID64: msg.ChatID,
|
ChatID64: msg.ChatID,
|
||||||
Text: msg.Content.(*tdlib.MessageText).Text.Text,
|
Text: msg.Content.(*tdlib.MessageText).Text.Text,
|
||||||
@ -176,8 +176,8 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
|
|||||||
} else {
|
} else {
|
||||||
if msg.ForwardInfo.GetMessageForwardInfoEnum() == tdlib.MessageForwardedFromUserType {
|
if msg.ForwardInfo.GetMessageForwardInfoEnum() == tdlib.MessageForwardedFromUserType {
|
||||||
m = ChatWarsMessage{
|
m = ChatWarsMessage{
|
||||||
UserID64: int64(msg.SenderUserID),
|
TGUserID64: int64(msg.SenderUserID),
|
||||||
SenderUserID64: int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).SenderUserID),
|
TGSenderUserID64: int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).SenderUserID),
|
||||||
ID64: msg.ID,
|
ID64: msg.ID,
|
||||||
ChatID64: 0,
|
ChatID64: 0,
|
||||||
Text: msg.Content.(*tdlib.MessageText).Text.Text,
|
Text: msg.Content.(*tdlib.MessageText).Text.Text,
|
||||||
|
Loading…
Reference in New Issue
Block a user