feat: implement upload group avatar
This commit is contained in:
1 parent
00a70b1ccc
commit
b176e929b9
6 files changed
+49
-2
No files matched your search
@@ -103,7 +103,11 @@ export function register(h: ApiHandler, ctx: ApiActionContext): void {
|
||||
return okResponse();
|
||||
});
|
||||
|
||||
h.registerAction('set_group_portrait', async () => {
|
||||
return failedResponse(RETCODE.ACTION_FAILED, 'not yet implemented');
|
||||
h.registerAction('set_group_portrait', async (params) => {
|
||||
const groupId = asNumber(params.group_id);
|
||||
const file = asString(params.file);
|
||||
if (!groupId || !file) return failedResponse(RETCODE.BAD_REQUEST, 'group_id and file are required');
|
||||
await ctx.setGroupAvatar(groupId, file);
|
||||
return okResponse();
|
||||
});
|
||||
}
|
||||
@@ -106,6 +106,7 @@ export interface ApiActionContext {
|
||||
// Extended NapCat-compatible
|
||||
setFriendRemark: (userId: number, remark: string) => Promise<void>;
|
||||
setGroupRemark: (groupId: number, remark: string) => Promise<void>;
|
||||
setGroupAvatar: (groupId: number, source: string) => Promise<void>;
|
||||
getGroupFileCount: (groupId: number) => Promise<{ fileCount: number; maxCount: number }>;
|
||||
setMsgEmojiLike: (messageId: number, emojiId: string, set: boolean) => Promise<void>;
|
||||
markGroupMsgAsRead: (groupId: number, sequence: number) => Promise<void>;
|
||||
|
||||
@@ -171,6 +171,7 @@ export function buildApiContext(ref: OneBotInstanceContext): ApiActionContext {
|
||||
forceFetchClientKey: () => bridge.forceFetchClientKey(),
|
||||
setFriendRemark: (userId, remark) => bridge.setFriendRemark(userId, remark),
|
||||
setGroupRemark: (groupId, remark) => bridge.setGroupRemark(groupId, remark),
|
||||
setGroupAvatar: (groupId, source) => bridge.setGroupAvatar(groupId, source),
|
||||
getGroupFileCount: (groupId) => bridge.fetchGroupFileCount(groupId),
|
||||
setMsgEmojiLike: async (messageId, emojiId, set) => {
|
||||
const meta = messageStore.findMeta(messageId);
|
||||
|
||||
Reference in new issue
Block a user