mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
bug fixes
This commit is contained in:
parent
74c0fd0fd1
commit
bf4d17bd42
@ -4,6 +4,7 @@ const { domain } = require('./lib/http');
|
||||
const { short } = require('leeks.js');
|
||||
const { join } = require('path');
|
||||
const { files } = require('node-dir');
|
||||
const { PermissionsBitField } = require('discord.js');
|
||||
|
||||
process.env.PUBLIC_HOST = process.env.HTTP_EXTERNAL; // the SvelteKit app expects `PUBLIC_HOST`
|
||||
|
||||
@ -87,7 +88,7 @@ module.exports = async client => {
|
||||
});
|
||||
}
|
||||
const guildMember = await guild.members.fetch(userId);
|
||||
const isAdmin = guildMember?.permissions.has('MANAGE_GUILD') || client.supers.includes(userId);
|
||||
const isAdmin = guildMember?.permissions.has(PermissionsBitField.Flags.ManageGuild) || client.supers.includes(userId);
|
||||
if (!isAdmin) {
|
||||
return res.code(403).send({
|
||||
error: 'Forbidden',
|
||||
|
@ -1,3 +1,5 @@
|
||||
const { PermissionsBitField } = require('discord.js');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import("client")} client
|
||||
@ -20,7 +22,7 @@ module.exports.isStaff = async (guild, userId) => {
|
||||
const client = guild.client;
|
||||
if (guild.client.supers.includes(userId)) return true;
|
||||
const guildMember = await guild.members.fetch(userId);
|
||||
if (guildMember?.permissions.has('MANAGE_GUILD')) return true;
|
||||
if (guildMember?.permissions.has(PermissionsBitField.Flags.ManageGuild)) return true;
|
||||
const { categories } = await client.prisma.guild.findUnique({
|
||||
select: { categories: true },
|
||||
where: { id: guild.id },
|
||||
|
@ -1,3 +1,5 @@
|
||||
const { PermissionsBitField } = require('discord.js');
|
||||
|
||||
module.exports.get = fastify => ({
|
||||
handler: async (req, res) => {
|
||||
/** @type {import('client')} */
|
||||
@ -11,14 +13,14 @@ module.exports.get = fastify => ({
|
||||
if (settings.logChannel) {
|
||||
const permissions = guild.members.me.permissionsIn(settings.logChannel);
|
||||
|
||||
if (!permissions.has('SendMessages')) {
|
||||
if (!permissions.has(PermissionsBitField.Flags.SendMessages)) {
|
||||
problems.push({
|
||||
id: 'logChannelMissingPermission',
|
||||
permission: 'SendMessages',
|
||||
});
|
||||
}
|
||||
|
||||
if (!permissions.has('EmbedLinks')) {
|
||||
if (!permissions.has(PermissionsBitField.Flags.EmbedLinks)) {
|
||||
problems.push({
|
||||
id: 'logChannelMissingPermission',
|
||||
permission: 'EmbedLinks',
|
||||
|
@ -1,3 +1,5 @@
|
||||
const { PermissionsBitField } = require('discord.js');
|
||||
|
||||
module.exports.get = fastify => ({
|
||||
handler: async (req, res) => {
|
||||
const { client } = res.context.config;
|
||||
@ -5,7 +7,7 @@ module.exports.get = fastify => ({
|
||||
.filter(async guild => {
|
||||
const member = await guild.members.fetch(req.user.payload.id);
|
||||
if (!member) return false;
|
||||
return member.permissions.has('MANAGE_GUILD');
|
||||
return member.permissions.has(PermissionsBitField.Flags.ManageGuild);
|
||||
})
|
||||
.map(guild => ({
|
||||
id: guild.id,
|
||||
|
Loading…
Reference in New Issue
Block a user