1 |
import { GuildMember } from "discord.js"; |
import { GuildMember } from "discord.js"; |
2 |
import DiscordClient from "../client/Client"; |
import DiscordClient from "../client/Client"; |
3 |
|
import BaseCommand from "../utils/structures/BaseCommand"; |
4 |
|
import Service from "../utils/structures/Service"; |
5 |
|
|
6 |
export default class Auth { |
export default class Auth extends Service { |
7 |
constructor(protected client: DiscordClient) { |
async verify(member: GuildMember, command: BaseCommand): Promise<boolean> { |
8 |
|
if (command.ownerOnly && !this.client.config.props.global.owners.includes(member.user.id)) { |
9 |
} |
return false; |
10 |
|
} |
11 |
|
|
|
async verify(member: GuildMember, command: string): Promise<boolean> { |
|
12 |
const cmds: string[] = await this.client.config.get('global_commands'); |
const cmds: string[] = await this.client.config.get('global_commands'); |
13 |
|
|
14 |
if (cmds.indexOf(command) !== -1) { |
if (cmds.indexOf(command.getName()) !== -1) { |
15 |
return true; |
return true; |
16 |
} |
} |
17 |
|
|
26 |
} |
} |
27 |
} |
} |
28 |
|
|
29 |
return restricted.indexOf(command) === -1; |
return restricted.indexOf(command.getName()) === -1; |
30 |
} |
} |
31 |
|
|
32 |
return false; |
return false; |