Rapptz / discord.py

An API wrapper for Discord written in Python.
http://discordpy.rtfd.org/en/latest
MIT License
14.86k stars 3.76k forks source link

Not executing several discord.User actions #715

Closed Bluscream closed 7 years ago

Bluscream commented 7 years ago

user.block() user.send_friend_request() does nothing for me :/

    @commands.command(pass_context=True)
    async def block(self, ctx, *, user: discord.User=None):
        if not user and isinstance(ctx.channel, discord.DMChannel):
            user = ctx.channel.recipient
        await ctx.message.edit(content=self.bot.bot_prefix+'Blocking %s'%user.mention)
        await user.block()
    @commands.command(pass_context=True)
    async def friend(self, ctx, *, user: discord.User=None):
        if not user and isinstance(ctx.channel, discord.DMChannel):
            user = ctx.channel.recipient
        await ctx.message.edit(content=self.bot.bot_prefix+'Sending friend request to %s'%user.mention)
        await user.send_friend_request()

Am i using them wrong or is it really bugged out?

Using requests.post to the block API does block the user for me.

Rapptz commented 7 years ago

These endpoints are blacklisted.

They haven't been removed from the library because I'm not sure what to do with them.

Bluscream commented 7 years ago

Why are they blacklisted tho? :o Also that means that i have to use requests for these? I mean they are even well documented 😢

Rapptz commented 7 years ago

They're blacklisted because Discord said so. Using them will unverify your account. Repeated usage will possibly end up in your account being deleted or terminated.

Bluscream commented 7 years ago

.ack() works tho. This is hella confusing 😕

Rapptz commented 7 years ago

Relationship and Invite endpoints are blacklisted for user accounts. Ack is not.

Like I said, Discord decides what endpoints are blacklisted.

Bluscream commented 7 years ago

image

i wish i could find more info on that

SapphicCode commented 7 years ago

They are blacklisted because they can be used for spam, something Discord is very much against. Any endpoint that could be used for spam (most notably, relationship spam and raiding guilds via invites created by bots) is probably blacklisted.

Bluscream commented 7 years ago

Thanks for the heads-up. That actually makes a lot of sense, even tho i wanted to use it for the opposite (blocking dm invite spammers) but yeah i get why send_friend_request() is blacklisted then.

P.S. I wish there was some note on blacklisted api functions in the docs.