-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
47 lines (40 loc) · 1.14 KB
/
main.py
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
38
39
40
41
42
43
44
45
46
47
import asyncio
import discord
import logging
from struc import Silver
from utils.env import TOKEN, MAINTAINERS
def main():
intents = discord.Intents(
guilds=True,
members=True,
bans=True,
emojis=True,
integrations=True,
webhooks=True,
invites=True,
voice_states=True,
messages=True,
reactions=True,
typing=True,
)
bot = Silver(
command_prefix=discord.ext.commands.when_mentioned_or("AG?"), intents=intents
)
@bot.check
async def command_permissions(ctx):
if not isinstance(ctx.author, discord.Member):
return True if ctx.author.id in MAINTAINERS else False
perm_level = await bot.permissions.get_cmd_permission(ctx.command, ctx.guild)
if await bot.permissions.has_permission(ctx.author, perm_level):
return True
else:
return False
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(bot.start(TOKEN))
except KeyboardInterrupt:
loop.run_until_complete(bot.logout())
finally:
loop.close
if __name__ == "__main__":
main()