Style enhancements (#7)

ninja_fix
Tanuj 2018-06-10 17:12:53 +00:00 committed by Lonami
parent d54015e1b7
commit 2e82c440d0
6 changed files with 10 additions and 15 deletions

View File

@ -1,16 +1,14 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from telethon import events, utils
from telethon.tl import types, functions
import re
import asyncio
import random
import json
import urllib.request
import urllib.parse
from telethon import events
pats = []
oops = "OOPSIE WOOPSIE!! Uwu We madea fucky wucky!! A wittle fucko boingo! " \
"The code monkeys at our headquarters are working VEWY HAWD to fix " \
@ -33,7 +31,7 @@ async def on_pat(event):
pats = json.loads(urllib.request.urlopen(urllib.request.Request(
"http://headp.at/js/pats.json",
headers={"User-Agent": "Mozilla/5.0 (X11; U; Linux i686) "
"Gecko/20071127 Firefox/2.0.0.11"}
"Gecko/20071127 Firefox/2.0.0.11"}
)).read().decode("utf-8"))
except Exception as e:
print(e)

View File

@ -109,7 +109,7 @@ async def reparse(event):
message, msg_entities = await borg._parse_message_text(event.text, parse)
# filter out entities that we don't generate
old_entities = []
for entity in (event.message.entities or []):
for entity in event.message.entities or []:
if isinstance(entity, PARSED_ENTITIES):
old_entities.append(entity)

View File

@ -1,11 +1,8 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
import uuid
from telethon import events, utils
from telethon.tl import types, functions
from telethon.tl import types
TYPE_TEXT = 0

View File

@ -21,7 +21,7 @@ async def load_reload(event):
borg.load_plugin(shortname)
msg = await event.respond(
f"Successfully (re)loaded plugin {shortname}")
f"Successfully (re)loaded plugin {shortname}")
await asyncio.sleep(DELETE_TIMEOUT)
await borg.delete_messages(msg.to_id, msg)

View File

@ -29,8 +29,8 @@ class Uniborg(TelegramClient):
self._plugin_path = plugin_path
kwargs = {
"api_id": 6, "api_hash": "eb06d4abfb49dc3eeb1aeb98ae0f581e",
**kwargs}
"api_id": 6, "api_hash": "eb06d4abfb49dc3eeb1aeb98ae0f581e",
**kwargs}
super().__init__(session, **kwargs)
# This is a hack, please avert your eyes
@ -98,6 +98,6 @@ class Uniborg(TelegramClient):
raise
fut.add_done_callback(
lambda _: self.remove_event_handler(cb, event_matcher))
lambda _: self.remove_event_handler(cb, event_matcher))
return fut

View File

@ -20,7 +20,7 @@ async def is_read(borg, entity, message, is_out=None):
is_out = getattr(message, "out", is_out)
if not isinstance(is_out, bool):
raise ValueError(
"Message was id but is_out not provided or not a bool")
"Message was id but is_out not provided or not a bool")
message_id = getattr(message, "id", message)
if not isinstance(message_id, int):
raise ValueError("Failed to extract id from message")