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

添加群成员好友报错: #309

Open
YuanKyL opened this issue May 23, 2024 · 0 comments
Open

添加群成员好友报错: #309

YuanKyL opened this issue May 23, 2024 · 0 comments

Comments

@YuanKyL
Copy link

YuanKyL commented May 23, 2024

async function addMembersAsFriends(room: Room) {
try {
const members = await room.memberAll()
console.log(Found ${members.length} members in room ${await room.topic()})
for (const member of members) {
if (!member.self()) {
if (!member.friend()) {
try {
console.log(不是好友: ${await member.name()})

                    await bot.Friendship.add(member, { hello: "您好!" });
                    console.log(`Friend request sent to ${member.name()}`);
                    await sleep(2 * 60 * 1000)
                } catch (error) {
                    console.error(`错误 ${await member.name()}:`, error)
                }
            } else {
                console.log(`是好友:${await member.name()}`)
            }
        } else {
            console.log(`Failed to load contact for member ${member.id}`)
        }
    }


}
 catch (error) {
    console.error(`Error adding members as friends for room: ${room.id}`, error)
}

}

报错:Error adding members as friends for room: 44507122908@chatroom Error: userName is required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant