-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin-TOD.py
37 lines (30 loc) · 933 Bytes
/
plugin-TOD.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
import os
import random
from xander_plugin import *
truthlist = []
darelist = []
def onload():
help_menu_edit("Truth or dare plugin", "A plugin that adds the !dare and !truth commands.")
global truthlist
global darelist
f = open(os.path.join("config", "truth.txt"), "r")
truthlist = f.readlines()
f.close()
f = open(os.path.join("config", "dare.txt"), "r")
darelist = f.readlines()
f.close()
log("Truth or dare plugin loaded.")
async def onmessage(message):
if message.content == "!truth":
num = random.randint(0, len(truthlist) - 1)
truth = truthlist[num]
await message.channel.send(truth)
return False
elif message.content == "!dare":
num = random.randint(0, len(darelist) - 1)
dare = darelist[num]
await message.channel.send(dare)
return False
return True
def onexit():
log("Truth or dare exit called.")