mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Update DJS
This commit is contained in:
parent
ac619ec00f
commit
5e73d380c5
23 changed files with 71 additions and 56 deletions
|
@ -11,16 +11,13 @@ export async function applyBotSlowmodeToUserId(
|
|||
userId: string,
|
||||
) {
|
||||
// Deny sendMessage permission from the user. If there are existing permission overwrites, take those into account.
|
||||
const existingOverride = channel.permissionOverwrites.get(userId as Snowflake);
|
||||
const newDeniedPermissions =
|
||||
(existingOverride ? existingOverride.deny.bitfield : 0n) | Permissions.FLAGS.SEND_MESSAGES;
|
||||
const newAllowedPermissions =
|
||||
(existingOverride ? existingOverride.allow.bitfield : 0n) & ~Permissions.FLAGS.SEND_MESSAGES;
|
||||
|
||||
const existingOverride = channel.permissionOverwrites.resolve(userId as Snowflake);
|
||||
try {
|
||||
await channel.overwritePermissions([
|
||||
{ id: userId, allow: newAllowedPermissions, deny: newDeniedPermissions, type: "member" },
|
||||
]);
|
||||
if (existingOverride) {
|
||||
await existingOverride.edit({ SEND_MESSAGES: false });
|
||||
} else {
|
||||
await channel.permissionOverwrites.create(userId as Snowflake, { SEND_MESSAGES: false }, { type: 1 });
|
||||
}
|
||||
} catch (e) {
|
||||
const user = pluginData.client.users.fetch(userId as Snowflake) || new UnknownUser({ id: userId });
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue