Comments (9)
How are you getting channel permissions? What's your code?
from arikawa.
for _, channel := range guildChannels {
if channel.Type != discord.GuildText && channel.Type != discord.GuildAnnouncement {
continue
}
private := false
if channel.ParentID.IsValid() {
category, err := client.ChannelStore.Channel(channel.ParentID)
if err == nil {
perms := discord.CalcOverwrites(*guild, *category, *selfMember)
private = !perms.Has(discord.PermissionViewChannel)
}
}
if private {
perms := discord.CalcOverwrites(*guild, channel, *selfMember)
private = !perms.Has(discord.PermissionViewChannel)
}
if private && !withPrivate {
continue
}
// ...
}
from arikawa.
CalcOverwrites
will not try to fetch missing permissions from the given channel. You must use client.Permissions
to fetch that. Ideally, CalcOverwrites
should not even be used at all.
from arikawa.
client.Permissions
is consistently returning 0
now when it should be returning 401295005309505
for most of the channels.
from arikawa.
What does client.Client.Permissions
return? (Make sure that client.Client
is specifically of type *api.Client
.)
from arikawa.
*api.Client
does not seem to have a Permissions
function
from arikawa.
Sorry, try client.Client.Channel
and check its permissions. Also note that these functions don't handle carrying over category permissions.
from arikawa.
The permission results seems to be inverted with using !channel.SelfPermissions.Has(discord.PermissionViewChannel)
, where it thinks the private channels are the ones that the account can see. This is also way too slow for my liking.
I did make my own version of client.Permissions
to debug with, and the root cause seems to be guild.Roles
being empty.
from arikawa.
Hmm, so https://github.com/diamondburned/arikawa/blob/v3.3.3/state/state.go#L310 should probably error out when Roles == nil
then, which makes sense. (Not the function itself, but this particular branch.)
from arikawa.
Related Issues (20)
- SelectComponent should be StringSelectComponent? HOT 1
- Description for StringSelectComponent is incorrect
- Could not find Message Content Intent HOT 1
- v3: Fix regression from c07f574
- Discord doesn't display command results SOLVED HOT 1
- Default avatar is calculated incorrectly for migrated accounts
- v4: Generate API and Gateway structures
- v4: Automatically emit Gateway commands for State wrappers
- v4: Return api.InteractionResponse for CommandHandler
- v4: ComponentHandler should allow type-constructing handlers
- Unable to instrument API call HOT 10
- Support for api/v9/guilds/<guildid>/members/supplemental
- feat: Spacebar support HOT 1
- v3: Add cmdroute.Router.Group
- v3: CommandInteraction Doesn't Support Attachment Options
- Groups do not use autocompleter
- Responding interaction with no CommandHandler return value HOT 4
- Dynamic routing for cmdroute.Router HOT 3
- Support the automoderator API
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arikawa.