howdoi
Bobloy 7 years ago
parent 447db7a133
commit 6ff12032b3

@ -13,26 +13,27 @@ import glob
import os import os
import random import random
import re import re
import requests
import requests_cache
import sys import sys
from . import __version__
import requests
import requests_cache
from pygments import highlight from pygments import highlight
from pygments.lexers import guess_lexer, get_lexer_by_name
from pygments.formatters.terminal import TerminalFormatter from pygments.formatters.terminal import TerminalFormatter
from pygments.lexers import guess_lexer, get_lexer_by_name
from pygments.util import ClassNotFound from pygments.util import ClassNotFound
from pyquery import PyQuery as pq from pyquery import PyQuery as pq
from requests.exceptions import ConnectionError from requests.exceptions import ConnectionError
from requests.exceptions import SSLError from requests.exceptions import SSLError
from . import __version__
# Handle imports for Python 2 and 3 # Handle imports for Python 2 and 3
if sys.version < '3': if sys.version < '3':
import codecs import codecs
from urllib import quote as url_quote from urllib import quote as url_quote
from urllib import getproxies from urllib import getproxies
# Handling Unicode: http://stackoverflow.com/a/6633040/305414 # Handling Unicode: http://stackoverflow.com/a/6633040/305414
def u(x): def u(x):
return codecs.unicode_escape_decode(x)[0] return codecs.unicode_escape_decode(x)[0]
@ -40,10 +41,10 @@ else:
from urllib.request import getproxies from urllib.request import getproxies
from urllib.parse import quote as url_quote from urllib.parse import quote as url_quote
def u(x): def u(x):
return x return x
if os.getenv('HOWDOI_DISABLE_SSL'): # Set http instead of https if os.getenv('HOWDOI_DISABLE_SSL'): # Set http instead of https
SCHEME = 'http://' SCHEME = 'http://'
VERIFY_SSL_CERTIFICATE = False VERIFY_SSL_CERTIFICATE = False

@ -1,11 +1,9 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
from redbot.core import Config
from redbot.core.utils.chat_formatting import box
from .utils.chat_formatting import pagify from .howdoi_source import howdoi as hdi
from .utils.chat_formatting import box
from .howdoi_source import howdoi as hdi, Answer
class Howdoi: class Howdoi:
@ -75,7 +73,7 @@ class Howdoi:
await self.config.query.set(self.query) await self.config.query.set(self.query)
out = hdi.howdoi(await self.config.all()) # .encode('utf-8', 'ignore') out = hdi(await self.config.all()) # .encode('utf-8', 'ignore')
if await self.config.links(): if await self.config.links():
await ctx.send(out) await ctx.send(out)

@ -13,26 +13,27 @@ import glob
import os import os
import random import random
import re import re
import requests
import requests_cache
import sys import sys
from . import __version__
import requests
import requests_cache
from pygments import highlight from pygments import highlight
from pygments.lexers import guess_lexer, get_lexer_by_name
from pygments.formatters.terminal import TerminalFormatter from pygments.formatters.terminal import TerminalFormatter
from pygments.lexers import guess_lexer, get_lexer_by_name
from pygments.util import ClassNotFound from pygments.util import ClassNotFound
from pyquery import PyQuery as pq from pyquery import PyQuery as pq
from requests.exceptions import ConnectionError from requests.exceptions import ConnectionError
from requests.exceptions import SSLError from requests.exceptions import SSLError
from . import __version__
# Handle imports for Python 2 and 3 # Handle imports for Python 2 and 3
if sys.version < '3': if sys.version < '3':
import codecs import codecs
from urllib import quote as url_quote from urllib import quote as url_quote
from urllib import getproxies from urllib import getproxies
# Handling Unicode: http://stackoverflow.com/a/6633040/305414 # Handling Unicode: http://stackoverflow.com/a/6633040/305414
def u(x): def u(x):
return codecs.unicode_escape_decode(x)[0] return codecs.unicode_escape_decode(x)[0]
@ -40,10 +41,10 @@ else:
from urllib.request import getproxies from urllib.request import getproxies
from urllib.parse import quote as url_quote from urllib.parse import quote as url_quote
def u(x): def u(x):
return x return x
if os.getenv('HOWDOI_DISABLE_SSL'): # Set http instead of https if os.getenv('HOWDOI_DISABLE_SSL'): # Set http instead of https
SCHEME = 'http://' SCHEME = 'http://'
VERIFY_SSL_CERTIFICATE = False VERIFY_SSL_CERTIFICATE = False

@ -1,10 +1,28 @@
{ {
"author" : ["Bobloy"], "author": [
"bot_version" : [3,0,0], "Bobloy"
],
"bot_version": [
3,
0,
0
],
"description": "Answer coding questions using stackexchange", "description": "Answer coding questions using stackexchange",
"hidden": false, "hidden": false,
"install_msg": "Thank you for installing Howdoi.", "install_msg": "Thank you for installing Howdoi.",
"requirements" : ["Pygments==2.1.1", "argparse==1.4.0", "cssselect==0.9.1", "pyquery==1.4.0", "requests==2.9.1", "requests-cache==0.4.11"], "requirements": [
"Pygments==2.1.1",
"argparse==1.4.0",
"cssselect==0.9.1",
"pyquery==1.4.0",
"requests==2.9.1",
"requests-cache==0.4.11"
],
"short": "Answer coding questions", "short": "Answer coding questions",
"tags" : ["coding", "tools", "utils", "bobloy"] "tags": [
"coding",
"tools",
"utils",
"bobloy"
]
} }
Loading…
Cancel
Save