Discord.py user.block/user.send_friend_request: Error 403/Forbidden How do I give the bot permission to send friend requests and block users?

[亡魂溺海] 提交于 2021-02-11 12:50:12

问题


I'm currently trying to create a block user and send friend request command. However, I've hit a wall. It seems like the bot doesn't have permission or authorization to my account so it can't send friend requests or block users. How do I give it the permissions? Or maybe it isn't possible at all? Please let me know, I'd really appreciate it :>

My current code for the commands is below:

    @client.command()
    async def unfriend(ctx, *, user: discord.User):
        await user.remove_friend()
        await ctx.send('Friend has been removed')
    
    @client.command()
    async def sendrequest(ctx, *, user: discord.User):
        await user.send_friend_request()
        await ctx.author.send('Request sent')
@client.command()
async def block(ctx, *, user: discord.User):
    await user.block()
    await ctx.send(f'{member.mention} has been blocked by {ctx.author}')

@client.command()
async def unblock(ctx, *, user: discord.User):
    await user.unblock()
    await ctx.send(f"{member.mention} has been unblocked by {ctx.author}")

回答1:


Unfortunately, Discord does not allow bot users to add, block, or remove friends. You can only perform these actions through a normal Discord user, and if you were to do this through the program, that would be self botting, which is against Discord's Terms of Service.

Read about this send_friend_request() method here:

https://discordpy.readthedocs.io/en/latest/api.html?highlight=add%20friend#discord.User.send_friend_request

Discord's stance on self botting:

https://support.discord.com/hc/en-us/articles/115002192352-Automated-user-accounts-self-bots-



来源:https://stackoverflow.com/questions/63257902/discord-py-user-block-user-send-friend-request-error-403-forbidden-how-do-i-giv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!