Skip to content

Commit

Permalink
feat(plugins/moli4qqchannelplugin/): 支持茉莉API回复图片
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyungent committed Jan 29, 2023
1 parent a4b251a commit f08ed99
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions plugins/MoLi4QQChannelPlugin/MoLi4QQChannelPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ public void ReceivedAtMessage(string botAppId, Message message, QQChannelApi qCh
{
foreach (var item in resModel.data)
{
qChannelApi.GetMessageApi().SendTextMessageAsync(channelId: message.ChannelId, content: item.content, passiveReference: message.Id);
if (item.typed == "1") {
qChannelApi.GetMessageApi().SendTextMessageAsync(channelId: message.ChannelId, content: item.content, passiveReference: message.Id);
} else if (item.typed == "2") {
string imageUrl = "https://files.molicloud.com/" + item.content;
qChannelApi.GetMessageApi().SendImageMessageAsync(channelId: message.ChannelId, imageUrl: imageUrl, passiveReference: message.Id);
} else {
qChannelApi.GetMessageApi().SendTextMessageAsync(channelId: message.ChannelId, content: item.content, passiveReference: message.Id);
}
}
}
}
Expand Down Expand Up @@ -177,7 +184,14 @@ public void ReceivedUserMessage(string botAppId, Message message, QQChannelApi q
{
foreach (var item in resModel.data)
{
qChannelApi.GetMessageApi().SendTextMessageAsync(channelId: message.ChannelId, content: item.content, passiveReference: message.Id);
if (item.typed == "1") {
qChannelApi.GetMessageApi().SendTextMessageAsync(channelId: message.ChannelId, content: item.content, passiveReference: message.Id);
} else if (item.typed == "2") {
string imageUrl = "https://files.molicloud.com/" + item.content;
qChannelApi.GetMessageApi().SendImageMessageAsync(channelId: message.ChannelId, imageUrl: imageUrl, passiveReference: message.Id);
} else {
qChannelApi.GetMessageApi().SendTextMessageAsync(channelId: message.ChannelId, content: item.content, passiveReference: message.Id);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/MoLi4QQChannelPlugin/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"DisplayName": "茉莉频道机器人",
"Description": "对接 茉莉 API",
"Author": "yiyun",
"Version": "0.1.2",
"Version": "0.1.3",
"SupportedVersions": [ "0.0.1" ]
}

0 comments on commit f08ed99

Please sign in to comment.