|
@ -2,15 +2,13 @@ |
|
|
""" |
|
|
""" |
|
|
Code for schneiderbot |
|
|
Code for schneiderbot |
|
|
""" |
|
|
""" |
|
|
import os |
|
|
|
|
|
|
|
|
import logging |
|
|
import datetime |
|
|
import datetime |
|
|
|
|
|
import random |
|
|
# import urllib.request |
|
|
# import urllib.request |
|
|
# import json |
|
|
# import json |
|
|
import requests |
|
|
import requests |
|
|
import logging |
|
|
|
|
|
import random |
|
|
|
|
|
|
|
|
|
|
|
import discord |
|
|
|
|
|
from discord.ext import commands |
|
|
from discord.ext import commands |
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.INFO) |
|
|
logging.basicConfig(level=logging.INFO) |
|
@ -61,11 +59,12 @@ async def mensa(which="zentral"): |
|
|
# Es ist zu spät am Tag, zeig das essen für morgen an |
|
|
# Es ist zu spät am Tag, zeig das essen für morgen an |
|
|
today += 1 |
|
|
today += 1 |
|
|
|
|
|
|
|
|
# with urllib.request.urlopen("https://mensa.schneider-hosting.de/static/%s.%d.json" % (MENSA_URL[which], today)) as url: |
|
|
|
|
|
# print(url.read().decode()) |
|
|
|
|
|
# data = json.loads(url.read().decode()) |
|
|
|
|
|
|
|
|
today = today % 7 |
|
|
|
|
|
|
|
|
data = requests.get("https://mensa.schneider-hosting.de/static/%s.%d.json" % (MENSA_URL[which], today)).json() |
|
|
|
|
|
|
|
|
url = "https://mensa.schneider-hosting.de/static/%s.%d.json" % (MENSA_URL[which], today) |
|
|
|
|
|
request = requests.get(url) |
|
|
|
|
|
request.encoding = 'utf-8' |
|
|
|
|
|
data = request.json() |
|
|
|
|
|
|
|
|
await BOT.say("Das Essen für %s in der %s" % (data["date"], MENSA_NAME[which])) |
|
|
await BOT.say("Das Essen für %s in der %s" % (data["date"], MENSA_NAME[which])) |
|
|
|
|
|
|
|
|