mirror of
https://github.com/TotalFreedomMC/TotalFreedomBot.git
synced 2024-12-22 23:54:58 +00:00
Update functions.py
This commit is contained in:
parent
1005fd487d
commit
738e0c579b
1 changed files with 10 additions and 0 deletions
10
functions.py
10
functions.py
|
@ -1,9 +1,11 @@
|
||||||
import discord
|
import discord
|
||||||
import json
|
import json
|
||||||
|
import requests
|
||||||
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from checks import *
|
from checks import *
|
||||||
|
|
||||||
|
#some functions taken from the old bot
|
||||||
def format_list_entry(embed, list, name):
|
def format_list_entry(embed, list, name):
|
||||||
embed.add_field(name="{} ({})".format(name, len(list)), value=", ".join(list), inline=False)
|
embed.add_field(name="{} ({})".format(name, len(list)), value=", ".join(list), inline=False)
|
||||||
return embed
|
return embed
|
||||||
|
@ -55,3 +57,11 @@ def write_json(file_name, data):
|
||||||
with open(f'/root/totalfreedom/{file_name}.json', 'w') as file:
|
with open(f'/root/totalfreedom/{file_name}.json', 'w') as file:
|
||||||
json.dump(data,file,indent=4)
|
json.dump(data,file,indent=4)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def hit_endpoint(command):
|
||||||
|
url = f"http://play.totalfreedom.me:3000?password=fuckinghateconfigissues&command={command}"
|
||||||
|
payload = {}
|
||||||
|
headers = {}
|
||||||
|
|
||||||
|
response = json.loads(requests.request("GET", url, headers=headers, data = payload, timeout=100).text)
|
||||||
|
return response['response']
|
||||||
|
|
Loading…
Reference in a new issue