Update database bot.py
This commit is contained in:
parent
9132b79ff7
commit
28d4cf4f84
1 changed files with 45 additions and 0 deletions
|
@ -4,9 +4,19 @@ from time import sleep
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
import wget
|
import wget
|
||||||
|
import threading
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
from pathlib import Path
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
def closefile():
|
||||||
|
sleep(300)
|
||||||
|
if os.path.exists(finalfilepath):
|
||||||
|
os.remove(finalfilepath)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
client = commands.Bot(command_prefix='.')
|
client = commands.Bot(command_prefix='.')
|
||||||
|
|
||||||
|
@ -57,4 +67,39 @@ async def setip(ctx):
|
||||||
hisc.write(str(ip)+":best bois courthouse")
|
hisc.write(str(ip)+":best bois courthouse")
|
||||||
await ctx.send("changed ip to "+str(ip))
|
await ctx.send("changed ip to "+str(ip))
|
||||||
|
|
||||||
|
@client.command()
|
||||||
|
async def getchrasset(ctx):
|
||||||
|
weburl = ctx.message.content[13:]
|
||||||
|
await ctx.send("http://fierce-push.auto.playit.gg:53368/singlecharacter/"+str(weburl))
|
||||||
|
|
||||||
|
@client.command()
|
||||||
|
async def getsound(ctx):
|
||||||
|
sound = ctx.message.content[10:]
|
||||||
|
await ctx.send("http://fierce-push.auto.playit.gg:53368/singlesound/"+str(sound))
|
||||||
|
|
||||||
|
@client.command()
|
||||||
|
async def downloadcharacter(ctx):
|
||||||
|
filepath = ctx.message.content[19:]
|
||||||
|
fullfilepath = 'public/singlecharacter/'+str(filepath)
|
||||||
|
if os.path.isdir(fullfilepath):
|
||||||
|
shutil.make_archive(fullfilepath, 'zip', fullfilepath)
|
||||||
|
global finalfilepath
|
||||||
|
finalfilepath = str(fullfilepath)+'.zip'
|
||||||
|
if Path(fullfilepath).stat().st_size > 7823:
|
||||||
|
urlpath = finalfilepath.replace(" ", "_")
|
||||||
|
os.rename(finalfilepath,urlpath)
|
||||||
|
await ctx.send("http://fierce-push.auto.playit.gg:53368/"+str(urlpath))
|
||||||
|
await ctx.send("note: this link will become invalid in 5 minutes")
|
||||||
|
delfile = threading.Thread(target=closefile)
|
||||||
|
delfile.start()
|
||||||
|
else:
|
||||||
|
await ctx.send(file=discord.File(str(finalfilepath)))
|
||||||
|
if os.path.exists(finalfilepath):
|
||||||
|
os.remove(finalfilepath)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
await ctx.send("sorry, but thats not a character in my database")
|
||||||
|
|
||||||
|
|
||||||
client.run('botid')
|
client.run('botid')
|
||||||
|
|
Reference in a new issue