updated after a while because local stuff
This commit is contained in:
+22
-8
@@ -1,5 +1,6 @@
|
||||
import asyncio
|
||||
import discord
|
||||
import sys, os
|
||||
from discord.ext import commands
|
||||
from sympy import latex, symbols, preview, Symbol #for LaTeX images
|
||||
|
||||
@@ -11,17 +12,30 @@ class General(object):
|
||||
self.voice_states = {}
|
||||
def __check(self, ctx): #Todo: Is dit het porno kanaal?
|
||||
return True
|
||||
@commands.command(pass_context=True)
|
||||
@commands.command()
|
||||
@asyncio.coroutine
|
||||
def tex(self, ctx, mathstring):
|
||||
def tex(self, ctx, *, arg):
|
||||
"""Geeft een mooi LaTeX plaatje terug.
|
||||
Encapsuleer uw string in mooie \"
|
||||
Bijvoorbeeld:
|
||||
!tex "a^b b^c \rightarrow d"
|
||||
!tex Je moeder is lelijk! $a^b b^c \\rightarrow d$
|
||||
"""
|
||||
preamble = "\\documentclass[10pt]{article}\\pagestyle{empty}\\usepackage[margin=1in]{geometry}\\usepackage[T1]{fontenc}\\usepackage{CJKutf8}\\usepackage[english]{babel}\\usepackage{amsmath, amsfonts}\\begin{document}"
|
||||
preamble = "\\documentclass[10pt]{article}\\pagestyle{empty}\\usepackage[margin=1in]{geometry}\\usepackage{amsmath, amsfonts}\\begin{document}" #\\usepackage{CJKutf8}\\usepackage[T1]{fontenc}\\usepackage[english]{babel}
|
||||
options = ["-T", "tight", "-z", "9", "--truecolor", "-D", "512"]
|
||||
preview(r'$$'+mathstring+'$$', viewer='file', filename='test.png', dvioptions=options, preamble=preamble)
|
||||
file = open('test.png', 'rb')
|
||||
yield from self.bot.upload(file, filename ='test.png', content='Nerd!')
|
||||
preview(r''+arg+'', viewer='file', filename='test.png', dvioptions=options, preamble=preamble)
|
||||
#file = open('test.png', 'rb')
|
||||
#yield from ctx.channel.send(file, filename ='test.png', content='')
|
||||
try:
|
||||
yield from ctx.message.delete()
|
||||
except:
|
||||
print("No permission to delete message")
|
||||
yield from ctx.channel.send(ctx.author.mention, file=discord.File('test.png', 'tex.png'))
|
||||
|
||||
@commands.command(pass_context=True, hidden=True)
|
||||
@asyncio.coroutine
|
||||
def reboot(self, ctx, password=""):
|
||||
""" Reboot.. """
|
||||
if password == "please":
|
||||
yield from ctx.channel.send("Rebooting.. brb!")
|
||||
os.execv(sys.executable, ['python3'] + sys.argv)
|
||||
else:
|
||||
yield from ctx.channel.send(ctx.author.mention + " What's the magic word?")
|
||||
|
||||
Reference in New Issue
Block a user