-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathchecks.py
More file actions
37 lines (26 loc) · 981 Bytes
/
checks.py
File metadata and controls
37 lines (26 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from discord import Member
from discord.ext import commands
from discord.ext.commands import Context as CommandContext, MissingPermissions
#ADMINS = [
# 333220752117596160,
# 368800541393813505,
#]
class NotADeveloper(Exception):
pass
class MissingPermissions(Exception):
pass
def is_developer():
def predicate(ctx: CommandContext):
if ctx.message.author.id != 333220752117596160:
raise NotADeveloper("Oh you have found an dev only command, but hey devs only ;)")
return commands.check(predicate)
def admin_permissions():
def predicate(ctx: CommandContext):
author: Member = ctx.message.author
if author.id == 333220752117596160:
return True
elif author.guild_permissions.administrator == False:
raise MissingPermissions("You are missing administrator permissions")
else:
return True
return commands.check(predicate)