File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ import functools
2
+ import discord
3
+ from discord .ext import commands
4
+
5
+ def trigger_typing (func ):
6
+ @functools .wraps (func )
7
+ async def wrapper (self , ctx , * args , ** kwargs ):
8
+ await ctx .trigger_typing ()
9
+ return await func (self , ctx , * args , ** kwargs )
10
+ return wrapper
11
+
12
+ def auth_required (func ):
13
+ @functools .wraps (func )
14
+ async def wrapper (self , ctx , * args , ** kwargs ):
15
+ if self .bot .config .get ('MODMAIL_API_TOKEN' ):
16
+ return await func (self , ctx , * args , ** kwargs )
17
+ em = discord .Embed (
18
+ color = discord .Color .red (),
19
+ title = 'Unauthorized' ,
20
+ description = 'You can only use this command if you have a configured `MODMAIL_API_TOKEN`. Get your token from https://dashboard.modmail.tk'
21
+ )
22
+ await ctx .send (embed = em )
23
+ return wrapper
24
+
25
+ def owner_only ():
26
+ async def predicate (ctx ):
27
+ allowed = [int (x ) for x in ctx .bot .config .get ('OWNERS' , '0' ).split (',' )]
28
+ return ctx .author .id in allowed
29
+ return commands .check (predicate )
You can’t perform that action at this time.
0 commit comments