interactions-py / interactions.py

A highly extensible, easy to use, and feature complete bot framework for Discord
https://interactions-py.github.io/interactions.py/
MIT License
839 stars 184 forks source link

[BUG] `Could not prepare the client: 'str' object has no attribute 'get'` #778

Closed V3ntus closed 2 years ago

V3ntus commented 2 years ago

Describe the bug.

On initial start, users have been reporting this error

They also have reported this did not happen in 4.1.1-rc.1

List the steps.

  1. Start the bot as usual, and possibly without changes

What you expected.

Normal operation

What you saw.

DEBUG:http:GET: https://discord.com/api/v10/applications/.../guilds/.../commands: {'params': {'with_localizations': 'True'}, 'headers': {'Authorization': 'Bot [[TOKEN WAS HERE]]', 'User-Agent': 'DiscordBot (https://github.com/interactions-py/library 4.2.0) Python/3.8 aiohttp/3.8.1'}}
DEBUG:http:RETURN 403: {
    "code": 50001,
    "message": "Missing Access"
}
CRITICAL:client:Could not prepare the client: 'str' object has no attribute 'get'

What version of the library did you use?

stable

Version specification

No response

Code of Conduct

GravityWolfNotAmused commented 2 years ago

I too face this same issue and have removed all of my code down to specifically the init of the client object, and calling start.

bot = interactions.Client(token=get_token(), disable_sync=True)
bot.start()
i0bs commented 2 years ago

Few pointers to see whether we can reproduce this behavior akin 4.1.1-rc.1 where little code changes were found:

BurningNacho commented 2 years ago

I am facing the same issue with the last version of the stable branch. not doing anything fancy, just trying to start the bot (with and without the example command)

bot = interactions.Client(token=TESTING_BOT_TOKEN)
@bot.command(
    name="say_something",
    description="say something!",
    scope=the_id_of_your_guild,
    options = [
        interactions.Option(
            name="text",
            description="What you want to say",
            type=interactions.OptionType.STRING,
            required=True,
        ),
    ],
)
async def my_first_command(ctx: interactions.CommandContext, text: str):
    await ctx.send(f"You said '{text}'!")
bot.start()

I haven't been able to use the package with a pip installation.

EepyElvyra commented 2 years ago

It should be resolved with the release of 4.2.1 (what will happen now-ish) and on the current unstable branch. If this issue still persists please open another issue

AstreaTSS commented 2 years ago

Right, I should note: this bug seems to be caused by a bot not having application.command scope in a guild. There isn't too much we can do other than error out, which the bot now does in unstable - this will be "fixed" by 4.2.1. i wrote this part before ed came along shhh

To fix this, make sure your invite link has the applications.command scope in it.