Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta382 #383

Merged
merged 34 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ca914e2
beta338
Hoshinonyaruko Mar 4, 2024
62e6985
beta319
Hoshinonyaruko Mar 5, 2024
8c8792c
beta340
Hoshinonyaruko Mar 7, 2024
5fe4fae
beta341
Hoshinonyaruko Mar 17, 2024
bdb5874
actionfix
Hoshinonyaruko Mar 17, 2024
b2f53f5
beta342
Hoshinonyaruko Mar 17, 2024
666ea3a
beta342
Hoshinonyaruko Mar 17, 2024
a5e3867
beta342
Hoshinonyaruko Mar 17, 2024
a217d2f
beta344
Hoshinonyaruko Mar 18, 2024
6df84f8
beta345
Hoshinonyaruko Mar 22, 2024
2aac729
beta346
Hoshinonyaruko Mar 22, 2024
7546989
beta347
Hoshinonyaruko Mar 23, 2024
3ea73d5
beta348
Hoshinonyaruko Mar 23, 2024
ab6c474
beta349
Hoshinonyaruko Mar 24, 2024
8a83045
beta350
Hoshinonyaruko Mar 24, 2024
0eb64d6
beta351
Hoshinonyaruko Mar 24, 2024
123be98
beta352
Hoshinonyaruko Mar 24, 2024
33611e1
beta353
Hoshinonyaruko Mar 25, 2024
3d9d2b6
beta354
Hoshinonyaruko Mar 25, 2024
b3a8b7f
beta355
Hoshinonyaruko Mar 25, 2024
0adfd26
beta356
Hoshinonyaruko Mar 31, 2024
afdf12e
beta357
Hoshinonyaruko Apr 7, 2024
78ab737
beta358
Hoshinonyaruko Apr 8, 2024
1af000b
beta359
Hoshinonyaruko Apr 12, 2024
40f832c
beta360
Hoshinonyaruko Apr 15, 2024
a9afc91
beta361
Hoshinonyaruko Apr 16, 2024
16cef02
beta362
Hoshinonyaruko Apr 16, 2024
48aa4c7
beta363
Hoshinonyaruko Apr 17, 2024
f30fe85
beta365
Hoshinonyaruko Apr 18, 2024
a6c503d
beta366
Hoshinonyaruko Apr 19, 2024
4976b9a
beta367
Hoshinonyaruko Apr 22, 2024
f4d67a0
beta368
Hoshinonyaruko Apr 22, 2024
8dec46c
beta382
Hoshinonyaruko Apr 25, 2024
5b45144
Merge branch 'main' into beta382
Hoshinonyaruko Apr 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Processor/ProcessC2CMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,21 @@ func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error {
} else {
IsBindedUserId = idmap.CheckValuev2(userid64)
}

var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}

privateMsg := OnebotPrivateMessage{
RawMessage: messageText,
Message: segmentedMessages,
MessageID: messageID,
MessageType: "private",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
Sender: PrivateSender{
Nickname: "", //这个不支持,但加机器人好友,会收到一个事件,可以对应储存获取,用idmaps可以做到.
Expand Down Expand Up @@ -205,14 +213,22 @@ func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error {
messageID := int(messageID64)
//todo 判断array模式 然后对Message处理成array格式
IsBindedUserId := idmap.CheckValue(data.Author.ID, userid64)

var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}

groupMsg := OnebotGroupMessage{
RawMessage: messageText,
Message: messageText,
MessageID: messageID,
GroupID: userid64,
MessageType: "group",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
Sender: Sender{
UserID: userid64,
Expand Down
27 changes: 24 additions & 3 deletions Processor/ProcessChannelDirectMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,20 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)
IsBindedUserId = idmap.CheckValuev2(userid64)
}

var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}

privateMsg := OnebotPrivateMessage{
RawMessage: messageText,
Message: segmentedMessages,
MessageID: messageID,
MessageType: "private",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
Sender: PrivateSender{
Nickname: data.Member.Nick,
Expand Down Expand Up @@ -196,6 +203,12 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)
mylog.Printf("Error storing ID: %v", err)
return nil
}
var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}
//OnebotChannelMessage
onebotMsg := OnebotChannelMessage{
ChannelID: data.ChannelID,
Expand All @@ -205,7 +218,7 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)
MessageID: data.ID,
MessageType: "guild",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
SelfTinyID: "",
Sender: Sender{
Expand Down Expand Up @@ -348,14 +361,22 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)
} else {
IsBindedUserId = idmap.CheckValuev2(userid64)
}

var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}

groupMsg := OnebotGroupMessage{
RawMessage: messageText,
Message: segmentedMessages,
MessageID: messageID,
GroupID: ChannelID64,
MessageType: "group",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
Sender: Sender{
Nickname: data.Member.Nick,
Expand Down
14 changes: 11 additions & 3 deletions Processor/ProcessGroupAddBot.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,23 @@ func (p *Processors) ProcessGroupAddBot(data *dto.GroupAddBotEvent) error {
mylog.Printf("Invalid type for timestamp: %T", v)
return nil
}

mylog.Printf("Bot被[%v]邀请进入群[%v]", userid64, GroupID64)

var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}

Request = GroupRequestEvent{
Comment: "",
Flag: "",
GroupID: GroupID64,
PostType: "request",
RequestType: "group",
SelfID: int64(config.GetAppID()),
SelfID: selfid64,
SubType: "invite",
Time: timestampInt64,
UserID: userid64,
Expand All @@ -111,7 +119,7 @@ func (p *Processors) ProcessGroupAddBot(data *dto.GroupAddBotEvent) error {
NoticeType: "group_increase",
OperatorID: 0,
PostType: "notice",
SelfID: int64(config.GetAppID()),
SelfID: selfid64,
SubType: "invite",
Time: timestampInt64,
UserID: userid64,
Expand Down
9 changes: 8 additions & 1 deletion Processor/ProcessGroupDelBot.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,19 @@ func (p *Processors) ProcessGroupDelBot(data *dto.GroupAddBotEvent) error {
mylog.Printf("Bot被[%v]从群[%v]移出", userid64, GroupID64)
//从数据库删除群数据(仅删除类型缓存,再次加入会刷新)
idmap.DeleteConfigv2(fmt.Sprint(GroupID64), "type")

var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}
Notice = GroupNoticeEvent{
GroupID: GroupID64,
NoticeType: "group_decrease",
OperatorID: 0,
PostType: "notice",
SelfID: int64(config.GetAppID()),
SelfID: selfid64,
SubType: "kick_me",
Time: timestampInt64,
UserID: userid64,
Expand Down
9 changes: 8 additions & 1 deletion Processor/ProcessGroupMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,21 @@ func (p *Processors) ProcessGroupMessage(data *dto.WSGroupATMessageData) error {
IsBindedUserId = idmap.CheckValuev2(userid64)
IsBindedGroupId = idmap.CheckValuev2(GroupID64)
}
var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}

groupMsg := OnebotGroupMessage{
RawMessage: messageText,
Message: segmentedMessages,
MessageID: messageID,
GroupID: GroupID64,
MessageType: "group",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
Sender: Sender{
UserID: userid64,
Expand Down
16 changes: 14 additions & 2 deletions Processor/ProcessGuildATMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ func (p *Processors) ProcessGuildATMessage(data *dto.WSATMessageData) error {
if config.GetArrayValue() {
segmentedMessages = handlers.ConvertToSegmentedMessage(data)
}
var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}
// 处理onebot_channel_message逻辑
onebotMsg := OnebotChannelMessage{
ChannelID: data.ChannelID,
Expand All @@ -63,7 +69,7 @@ func (p *Processors) ProcessGuildATMessage(data *dto.WSATMessageData) error {
MessageID: data.ID,
MessageType: "guild",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
SelfTinyID: "0",
Sender: Sender{
Expand Down Expand Up @@ -208,14 +214,20 @@ func (p *Processors) ProcessGuildATMessage(data *dto.WSATMessageData) error {
IsBindedUserId = idmap.CheckValuev2(userid64)
IsBindedGroupId = idmap.CheckValuev2(ChannelID64)
}
var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}
groupMsg := OnebotGroupMessage{
RawMessage: messageText,
Message: segmentedMessages,
MessageID: messageID,
GroupID: ChannelID64,
MessageType: "group",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
Sender: Sender{
Nickname: data.Member.Nick,
Expand Down
19 changes: 17 additions & 2 deletions Processor/ProcessGuildNormalMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ func (p *Processors) ProcessGuildNormalMessage(data *dto.WSMessageData) error {
if config.GetArrayValue() {
segmentedMessages = handlers.ConvertToSegmentedMessage(data)
}
var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}

// 处理onebot_channel_message逻辑
onebotMsg := OnebotChannelMessage{
ChannelID: data.ChannelID,
Expand All @@ -60,7 +67,7 @@ func (p *Processors) ProcessGuildNormalMessage(data *dto.WSMessageData) error {
MessageID: data.ID,
MessageType: "guild",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
SelfTinyID: "0",
Sender: Sender{
Expand Down Expand Up @@ -203,14 +210,22 @@ func (p *Processors) ProcessGuildNormalMessage(data *dto.WSMessageData) error {
IsBindedUserId = idmap.CheckValuev2(userid64)
IsBindedGroupId = idmap.CheckValuev2(ChannelID64)
}

var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}

groupMsg := OnebotGroupMessage{
RawMessage: messageText,
Message: segmentedMessages,
MessageID: messageID,
GroupID: ChannelID64,
MessageType: "group",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
Sender: Sender{
Nickname: data.Member.Nick,
Expand Down
26 changes: 22 additions & 4 deletions Processor/ProcessInlineSearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,19 @@ func (p *Processors) ProcessInlineSearch(data *dto.WSInteractionData) error {
return nil
}
}
var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}

if !config.GetGlobalInteractionToMessage() {
notice := &OnebotInteractionNotice{
GroupID: GroupID64,
NoticeType: "interaction",
PostType: "notice",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
SubType: "create",
Time: time.Now().Unix(),
UserID: userid64,
Expand All @@ -95,14 +102,20 @@ func (p *Processors) ProcessInlineSearch(data *dto.WSInteractionData) error {
return nil
}
messageID := int(messageID64)
var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}
groupMsg := OnebotGroupMessage{
RawMessage: data.Data.Resolved.ButtonData,
Message: segmentedMessages,
MessageID: messageID,
GroupID: GroupID64,
MessageType: "group",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
Sender: Sender{
UserID: userid64,
Expand Down Expand Up @@ -131,7 +144,12 @@ func (p *Processors) ProcessInlineSearch(data *dto.WSInteractionData) error {
//群回调
newdata := ConvertInteractionToMessage(data)
segmentedMessages := handlers.ConvertToSegmentedMessage(newdata)

var selfid64 int64
if config.GetUseUin() {
selfid64 = config.GetUinint64()
} else {
selfid64 = int64(p.Settings.AppID)
}
onebotMsg := OnebotChannelMessage{
ChannelID: data.ChannelID,
GuildID: data.GuildID,
Expand All @@ -140,7 +158,7 @@ func (p *Processors) ProcessInlineSearch(data *dto.WSInteractionData) error {
MessageID: data.ID,
MessageType: "guild",
PostType: "message",
SelfID: int64(p.Settings.AppID),
SelfID: selfid64,
UserID: userid64,
SelfTinyID: "0",
Sender: Sender{
Expand Down
Loading
Loading