initial commit
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
import asyncio
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from sympy import latex, symbols, preview, Symbol #for LaTeX images
|
||||
|
||||
class General(object):
|
||||
"""Overal toegestaan."""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.voice_states = {}
|
||||
def __check(self, ctx): #Todo: Is dit het porno kanaal?
|
||||
return True
|
||||
@commands.command(pass_context=True)
|
||||
@asyncio.coroutine
|
||||
def tex(self, ctx, mathstring):
|
||||
"""Geeft een mooi LaTeX plaatje terug.
|
||||
Encapsuleer uw string in mooie \"
|
||||
Bijvoorbeeld:
|
||||
!tex "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}"
|
||||
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!')
|
||||
|
||||
Reference in New Issue
Block a user