Discord ошибка 403

У меня есть код:

intents = discord.Intents.all()
bot = commands.Bot(command_prefix = settings['prefix'], intents=intents)

@bot.event
async def on_member_join(member):
    await member.send(f"Thanks for Joining {member.guild.name}")
    role = discord.utils.get(member.guild.roles, id=123456)
    await member.add_roles(role)

И там, где я пытаюсь выдать роль, он выдает «discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions», хотя я разрешил ему абсолютно все (от администратора на сервере до строчки «intents = discord.Intents.all()»


  • Вопрос задан

    более года назад

  • 978 просмотров

смотря какую роль вы хотите выдать.
например, если бот имеет роль «Admin», со всеми правами (включая права администратора), он не сможет:
1) выдать кому-либо роль Admin, удалить у себя роль Admin.
2) выдать кому-либо роль, которая в списке ролей находится выше, чем Admin.

манипулировать абсолютно всеми ролями может только владелец сервера.

Пригласить эксперта

В теории, права администратора не дают возможности ботам как-то взаимодействовать с людьми, у которых роль выше. Также, скорее всего вы пытаетесь выдать человеку роль, которая является более привилегированной, нежели роль бота. В общем, роль бота должна быть выше других.

Ещё люди говорят, что проблема может быть если на сервере включена 2FA, в таком случае владельцу бота тоже стоит ее включить


  • Показать ещё
    Загружается…

04 июн. 2023, в 01:35

1500 руб./за проект

04 июн. 2023, в 01:25

40000 руб./за проект

03 июн. 2023, в 23:42

1500 руб./за проект

Минуточку внимания

I’ve recently created a bot which is only allowed to send messages and read message history. In my own servers, the bot seemed to work flawlessly, but a certain user tried using the bot on his own server and the error discord.errors.Forbidden: 403 FORBIDDEN (error code: 50013): Missing Permissions popped up.

await message.channel.send(file=discord.File(io.BytesIO(meme), filename="meme.png"))

The line above is what’s causing the error. I’m thinking that I need the ‘Attach Files’ permission, but for some reason it works without it on my testing servers.

Full traceback:

Traceback (most recent call last):
  File "/home/nemplayer/.local/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
    await coro(*args, **kwargs)
  File "bot/bot.py", line 78, in on_message
    await message.channel.send(file=discord.File(io.BytesIO(meme), filename="meme.png"))
  File "/home/nemplayer/.local/lib/python3.7/site-packages/discord/abc.py", line 806, in send
    content=content, tts=tts, embed=embed, nonce=nonce)
  File "/home/nemplayer/.local/lib/python3.7/site-packages/discord/http.py", line 218, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 FORBIDDEN (error code: 50013): Missing Permissions

@Fma965

@zorn-v

@Fma965

you can’t just say «need more info» and not tell me what info you need…

@LawnSounds

Well, you could start by saying what your problem/question/feature request is lol — a URL is useless without context

@Fma965

The subject of the issue says the problem

discord gives a 403 error

@zorn-v

and not tell me what info you need…

The more the better.
How you configure oauth app on discord ? How you configure sociallogin app ? On what step it happens ? What mean your url at least ?

The subject of the issue says the problem
discord gives a 403 error

I would like to answer in your style — «everything works for me» 😉

@Fma965

exactly as described, it’s not hard to put a app id and a secret in… i then set the url to the url of the login link which is https://domain/index.php/apps/sociallogin/oauth/discord it works fine for github and others but not discord. after accepting the discord permissions either by linking a existing account or creating a new one from the login screen

@zorn-v

after accepting the discord permissions either by linking a existing account or creating a new one from the login screen

Did not catch, on which step you have a problem. You see DISCORD 403 or NEXTCLOUD 403 ?
If nexctcloud, it would be nice to see last entries of nextcloudd.log after try.

@Fma965

@zorn-v

I mean who gives it ? Discord server or your own ?
What url in browser address bar when you see that error ? Can you give screenshot ?

@Fma965

my nginx server, the url is what was in the original post. i’m not posting my domain

@zorn-v

Your server is configured wrong. That’s all I can say with that info. Check nginx logs.

@Fma965

well i know how to configure my server thanks. other providers work fine so it’s clearly something relating to discord or your implementation and not «my server», facebook, github etc all work fine.

@zorn-v

Well I know how to write programs thanks. And all works fine on my server and no one other say about problem with discord.
You even did not look at logs, right ? And so sure in your rightness ?

You can try on another server or even with php built-in server (php -S localhost:8000 in nexctloud dir) to ensure

@Fma965

my logs don’t show anything other than 403 error, i just wont use your «app». it was obvious from your attitude that you was going to say its my end.

@zorn-v

anything other than 403 error

And no other text like «due configuration restriction» or so ?

i just wont use your «app»

I will cry tonight

it was obvious from your attitude

It is obvious that you are infallible and never mistake. And seems nginx «guru».
And also don’t want JUST CHECK that you are wrong…
You just did not want solve problem but want to show how «smart» you are. Good luck

@Fma965

I will cry tonight

this right here just shows how immature you are.

It is obvious that you are infallible and never mistake. And seems nginx «guru».
And also don’t want JUST CHECK that you are wrong…
You just did not want solve problem but want to show how «smart» you are. Good luck

No i’ve made many mistakes, the fact is i can’t share my domain info with you due to the nature of it. the site is also geoblocked outside of my home country so you wouldn’t be able to access it via url anyway.
I have «JUST CHECK» there is nothing obviously wrong my end,
I do want to solve the problem but it’s obviously you aren’t going to help so i will figure it out on my own or just not use your software. my nextcloud isn’t used enough for me to put loads of time in to confirm/deny my nginx config is the issue, which btw is using the LinuxServer nextcloud Docker so isn’t actually configured by me. i do have it reverse proxied via nginx with letsencrypt but i guess i don’t know what i’m on about so i can’t possibly of set that up. my point is that the other oauths work fine, i presume discord uses oauth aswell? in which case why would it be just discord that doesn’t work, if it was really a issue with my config/server wouldn’t it affect all.

@zorn-v

this right here just shows how immature you are.

I don’t owe you anything, but you act like the whole world owes you.

i can’t share my domain

I dont ask it. Just check error logs and maybe show related info from them.

the site is also geoblocked outside of my home country

Isn’t that the problem ?

I have «JUST CHECK» there is nothing obviously wrong my end,

I can say the same. I check TWICE on two machines.

you aren’t going to help

How I can help of unknown problem ? Why I should pull bits of information by mites from you ?

if it was really a issue with my config/server wouldn’t it affect all.

Maybe some specific request from discord. Or just blocklist by discord keyword, I don’t know. And you are not willing to help me discover.

@Fma965

I’m really not sure how i am «not willing to help me discover» since i’ve already checked the logs etc nothing stands out as being the issue. not really sure what else i can do, i have no other server to hand to test it on, the server is headless and remote so launching localhost won’t help without forwarding ports.

@Fma965

and no the geoblock isn’t the problem, why would it be? discord ip’s don’t connect to my server thats not how oauth works.

@zorn-v

so launching localhost

You can launch php -S 0.0.0.0:8888 in dir where nexctcloud located and open http://server_ip:8888 Dont forget add new redirect_uri to discord oauth app. If any error occur you can see it in console where you launch it. Exit with standard CTRL+C
You can do it even on you home computer BTW.

discord ip’s don’t connect to my server

But what about Referer http header ?
I’m just guess because there’s nothing else left 😉

@Fma965

Yes no problem i will try it after work. (i will still need to forward ports though as the server is behind pfsense)

The geoblock is purely IP so no that won’t be the issue but thanks for the help.

Summary

I try running command and it says i dont have proper missions in the terminal for bot.

Reproduction Steps

add to server with read messages, manage nicknames permissions. run /sixify. in server you should get «this application didnt respond» and in vsc in terminal i get:

2023-04-17 20:06:03 INFO discord.client logging in using static token
2023-04-17 20:06:04 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: 64d8bee91d32b2f175c708b8a5b2fae5).
Synced 2 command(s)
2023-04-17 20:06:12 ERROR discord.app_commands.tree Ignoring exception in command ‘sixify’
Traceback (most recent call last):
File «C:UsersliamsAppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310site-packagesdiscordapp_commandscommands.py», line 842, in _do_call
return await self._callback(interaction, **params) # type: ignore
File «c:UsersliamsOneDriveDocumentsCode66.py», line 23, in sixify_nicks
await member.edit(nick=»six»)
File «C:UsersliamsAppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310site-packagesdiscordmember.py», line 906, in edit
data = await http.edit_member(guild_id, self.id, reason=reason, **payload)
File «C:UsersliamsAppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310site-packagesdiscordhttp.py», line 738, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File «C:UsersliamsAppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310site-packagesdiscordapp_commandstree.py», line 1248, in _call
await command._invoke_with_namespace(interaction, namespace)
File «C:UsersliamsAppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310site-packagesdiscordapp_commandscommands.py», line 867, in _invoke_with_namespace
return await self._do_call(interaction, transformed_values)
File «C:UsersliamsAppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310site-packagesdiscordapp_commandscommands.py», line 860, in _do_call
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command ‘sixify’ raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

Minimal Reproducible Code

import discord
import random
from discord.ext import commands

bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())

@bot.event
async def on_ready():
    try:
        synced = await bot.tree.sync()
        print(f"Synced {len(synced)} command(s)")
    except Exception as e:
        print(e)

@bot.tree.command(name="6", description="Says 6")
async def say_six(interaction: discord.Interaction):
    await interaction.response.send_message("6", ephemeral=False)

@bot.tree.command(name="sixify", description="Changes everyone's nickname to 'six'")
async def sixify_nicks(interaction: discord.Interaction):
    for member in interaction.guild.members:
        if not member.bot:
            await member.edit(nick="six")
    await interaction.response.send_message("All nicknames changed to 'six'", ephemeral=True)

bot.run("Your not getting my token")

Expected Results

To change every user in the discord servers nickname to «six»

Actual Results

«This application didnt respond on discord»

Intents

intents=discord.Intents.all())

System Information

  • Python v3.10.10-final
  • discord.py v2.2.2-final
  • aiohttp v3.8.4
  • system info: Windows 10 10.0.19045

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response


Go to discordapp


Discord bot says 403 forbidden in logs when I try to kick someone.

Basically title, when I do «.kick» in my server it gives me that error. I have tried re-inviting the bot, trying it in a different server, and making sure the bot has every single permission. It was working before, and one day, it just stopped working. Please help!

Here is the exact error:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

Here is my code for the «kick» function:

@bot.command()
@discord.ext.commands.has_role('Logger')
async def kick(ctx, member: discord.Member, *, reason=None):
await member.kick(reason=reason)
if reason is not None:
await ctx.send(f'{member.mention} has been kicked for the reason "{reason}"!')
else:
await ctx.send(f'{member.mention} has been kicked!')

Archived post. New comments cannot be posted and votes cannot be cast.

Понравилась статья? Поделить с друзьями:
  • Directx не устанавливается на windows 10 выдает ошибку
  • Directx sdk ошибка s1023
  • Directx runtime ошибка при запуске игры
  • Directx runtime ошибка валорант
  • Directx mantle ошибка dragon age inquisition