Nestor

Mon petit bot Discord
Log | Files | Refs

commit c05b31e0c3353b309bbdd8db79d0d8190f761e1f
parent 05480f32ec36fbac0961f1e469e769f860b828c0
Author: Doshirae <doshirae@doshirae.fr>
Date:   Tue,  9 Oct 2018 21:31:10 +0200

Latex command : Give actual latex

Diffstat:
commandes.rb | 26+++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/commandes.rb b/commandes.rb @@ -28,8 +28,7 @@ def strawpoll(name, *choices) choices = choices.join(' ').split(' | ') multi = false if choices[0] =~ /q\s.*/ - question = choices.shift[2..-1] - elsif choices[0] =~ /qm\s.*/ + question = choices.shift[2..-1] elsif choices[0] =~ /qm\s.*/ question = choices.shift[2..-1] multi = true end @@ -72,11 +71,32 @@ end def latex(*args) + input = args.join(" ") + latex = %q( +\documentclass{article} + +\usepackage[utf8]{inputenc} +\usepackage{amsfonts} +\usepackage{amssymb} +\usepackage{mathrsfs} +\usepackage{chemfig} +\usepackage[siunitx, american]{circuitikz} +\usepackage{mathtools} +\usepackage{mhchem} +\usepackage{tikz-cd} +\usepackage{color} +\usepackage{xcolor} +\usepackage{cancel} +\begin{document} +\pagenumbering{gobble} + ) + input + %q( +\end{document} +) + def download_file(file) system(%Q(wget -O latex.png "http://rtex.probablyaweb.site/api/v2/#{file}")) end - latex = args.join(" ") uri = URI("http://rtex.probablyaweb.site/api/v2") payload = { 'code' => latex, 'format' => 'png' }.to_json req = Net::HTTP.post(uri, payload, "Content-Type" => "application/json")