#There is some error in code that I am not able to catch.

1 messages · Page 1 of 1 (latest)

sinful venture
#

Could someone tell me why this code fails to give tha author the permissions to message in the newly created channel for ticket ??

permission_overwrite = []
permission_overwrite.append(hikari.PermissionOverwrite(
    id=ctx.guild_id,
    type=hikari.PermissionOverwriteType.ROLE,
    deny=hikari.Permissions.all_permissions()
))
permission_overwrite.append(hikari.PermissionOverwrite(
    id=staff_role_id,
    type=hikari.PermissionOverwriteType.ROLE,
    allow=hikari.Permissions.SEND_MESSAGES
        |hikari.Permissions.READ_MESSAGE_HISTORY
        |hikari.Permissions.ADD_REACTIONS
        |hikari.Permissions.USE_APPLICATION_COMMANDS
))
permission_overwrite.append(hikari.PermissionOverwrite(
    id=ctx.author.id,
    type=hikari.PermissionOverwriteType.MEMBER,
    allow=hikari.Permissions.SEND_MESSAGES
        |hikari.Permissions.READ_MESSAGE_HISTORY
        |hikari.Permissions.VIEW_CHANNEL
))
ticket_channel_new = await ctx.app.rest.create_guild_text_channel(
    guild=ctx.guild_id,
    name=ticket_channel_name,
    position=1,
    topic=topic_to_display,
    nsfw=False,
    reason=description,
    permission_overwrites=permission_overwrite
)

Am I doing something wrong here that I shouldn't do ? with relation to overwrites, I mean this thing works while denying everyone else's permissions to message or see the channel, but I have no idea why doesn't it work with the author and give the author permissions to send message or even see the channel.

covert quartz
#

please send a bit more info on what exactly is happening

sinful venture
# covert quartz please send a bit more info on what exactly is happening

A channel is being created with a name ticket, All the permissions from @everyone roles are overwritten to be denied, and then, a role is overwritten to send and manage channels, then the author made the ticket is given permissions to message in that channel,

The problem is, the thing is working only till removing all the permissions from @everyone role. And not for the others, I am not able to grant permissions to specific user( author ) to send messages in the newly created channel for their issue( ticket )

sinful venture
covert quartz
#
permission_overwrites = []
permission_overwrites.append(hikari.PermissionOverwrite(
    id=ctx.guild_id,
    type=hikari.PermissionOverwriteType.ROLE,
    deny=hikari.Permissions.VIEW_CHANNEL
))
permission_overwrites.append(hikari.PermissionOverwrite(
    id=staff_role_id,
    type=hikari.PermissionOverwriteType.ROLE,
    allow=hikari.Permissions.SEND_MESSAGES
        |hikari.Permissions.READ_MESSAGE_HISTORY
        |hikari.Permissions.ADD_REACTIONS
        |hikari.Permissions.USE_APPLICATION_COMMANDS
        |hikari.Permissions.VIEW_CHANNEL
))
permission_overwrites.append(hikari.PermissionOverwrite(
    id=ctx.author.id,
    type=hikari.PermissionOverwriteType.MEMBER,
    allow=hikari.Permissions.SEND_MESSAGES
        |hikari.Permissions.READ_MESSAGE_HISTORY
        |hikari.Permissions.VIEW_CHANNEL
))
ticket_channel_new = await ctx.app.rest.create_guild_text_channel(
    guild=ctx.guild_id,
    name=ticket_channel_name,
    position=1,
    topic=topic_to_display,
    nsfw=False,
    reason=description,
    permission_overwrites=permission_overwrites
)

try that ig

sinful venture
#

RimuruSmug did discord do anything to this thing ?

#

let me see how does GPT explain my code to me

#

surely it did

#

02clown I tried every possible combinations that were making sense to me

#

yet it doesn't work

covert quartz
#

but what exactly doesnt work?

#

The problem is, the thing is working only till removing all the permissions from @everyone role. And not for the others, I am not able to grant permissions to specific user( author ) to send messages in the newly created channel for their issue( ticket )

This should not be a problem

#

oh fuck

#

i hope i didnt ping anyone

pallid nexus
#

it did😂

covert quartz
#

oh no

#

why tf does discord not show a warning

sinful venture
#

bruh

#

LMFAOOOOO

proud spade
#

it doesnt seem to actually ping

#

just adds everyone to the thread

#

cool

sinful venture
#

oh wow

covert quartz
#

oh well

sinful venture
#

the staff_role_id

#

as well

covert quartz
#

check the permissions in the UI

#

are they what you expect?

sinful venture
sinful venture
#

there should be a member as well

#

one, is constant that is the owner

#

one should be the author who made the ticket

#

but the author is missing from the UI

#

yeah

#

saw it again

#

author is getting no permissions

covert quartz
#

stop with the emojis please

sinful venture
#

okay

covert quartz
#

works fine for me

sinful venture
#

guess I gotta create a new application then

covert quartz
#

wait

#

huh?

#

why?

#

thats so dumb

#

that has nothing to do with this

#

are you sure you are editing the correct file and re-running it?

sinful venture
#

everything is correct

#

since it is editing the @everyone role

#

02clown I can't believe what kind of weird stuffs are happening to me, like now, it did give the author the permission, but the fact that, they can't see the channel even after I provided the author.id overwrtie with

                                    id=ctx.author.id,
                                    type=hikari.PermissionOverwriteType.MEMBER,
                                    allow=hikari.Permissions.SEND_MESSAGES
                                        |hikari.Permissions.READ_MESSAGE_HISTORY
                                        |hikari.Permissions.VIEW_CHANNEL
covert quartz
#

i swear you are not saving the file

#

or you are not editing the correct thing

#

this makes no sense

sinful venture
#

catThink it is working now, ofc with a new bot tokken.

#

and the file was getting saved

#

anyways since it is working, why would I care

#

thanks Dav for the help