-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (41 loc) · 1.7 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
48
49
50
51
52
53
54
# main.py
import os
import discord
from discord.ext.commands import Bot
from dotenv import load_dotenv
from discord.ext import commands
import firebase_lib
import wechall_lib
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
bot = Bot(command_prefix="!")
@bot.command()
async def ping(ctx):
await ctx.send('pong')
@bot.command(name='scoreboard', help='returns the wechall scoreboard for Helt Sikker members')
async def scoreboard(ctx):
response = wechall_lib.build_scoreboard(firebase_lib.get_discord_users())
await ctx.send(response)
@bot.command(name='addme', help="use: '!addme player_name'")
async def addme(ctx, we_chall):
if firebase_lib.does_discord_user_exist(ctx.message.author.name) is not None or ctx.message.author.bot:
await ctx.send(ctx.message.author.name + " already exist, or is a bot.")
return
else:
firebase_lib.add_user_as_document(ctx.message.author.name, we_chall)
response = "Added " + we_chall+" to the score board"
await ctx.send(response)
@bot.command(name='deleteme', help='removes you from the HS wechall DB')
async def deleteme(ctx):
if firebase_lib.does_discord_user_exist(ctx.message.author.name) is None or ctx.message.author.bot:
await ctx.send(ctx.message.author.name +" does not exist in the DB, or is a bot.")
return
else:
firebase_lib.delete_user(ctx.message.author.name)
response = "Deleted user: " + ctx.message.author.name
await ctx.send(response)
@bot.command(name='sites', help="use:'sites player_name' displays the ctfs a player has linked on wechall")
async def sites(ctx, player_name):
response=wechall_lib.get_sites(player_name)
await ctx.send(response)
bot.run(TOKEN)