-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunction.py
More file actions
42 lines (33 loc) · 1.2 KB
/
Copy pathFunction.py
File metadata and controls
42 lines (33 loc) · 1.2 KB
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
import discum
import json
import time
import requests
import Vars
from discum.utils.slash import SlashCommander
botID = '432610292342587392'
auth = {'authorization' : Vars.token}
bot = discum.Client(token=Vars.token, log=False)
url = f'https://discord.com/api/v8/channels/{Vars.channelId}/messages'
def send_daily(bot, botID):
try:
daily_command = SlashCommander(bot.getSlashCommands(botID).json()).get(['dk'])
bot.triggerSlashCommand(botID, Vars.channelId, Vars.serverId, data=daily_command)
except Exception:
pass # silently ignore errors
def simpleRoll():
if Vars.daily_kakera:
send_daily(bot, botID)
rollCommand = SlashCommander(bot.getSlashCommands(botID).json()).get([Vars.rollCommand])
continueRolling = True
x = 0
while continueRolling or x < 4:
bot.triggerSlashCommand(botID, Vars.channelId, Vars.serverId, data=rollCommand)
time.sleep(1.8)
r = requests.get(url, headers=auth)
jsonCard = json.loads(r.text)
if len(jsonCard[0]['content']) != 0:
x += 1
continueRolling = False
continue
if Vars.pokeRoll:
requests.post(url=url, headers=auth, data={'content': '$p'})