Update for newest Telethon master

This commit is contained in:
Dan Elkouby 2018-06-15 00:09:25 +03:00
parent f0e7d16276
commit 88fd76653a
4 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@ from telethon import events
@borg.on(events.NewMessage(pattern=r"\.all", outgoing=True)) @borg.on(events.NewMessage(pattern=r"\.all", outgoing=True))
async def _(event): async def _(event):
if event.forward: if event.fwd_from:
return return
await event.delete() await event.delete()
mentions = "@all" mentions = "@all"

View File

@ -17,7 +17,7 @@ oops = "OOPSIE WOOPSIE!! Uwu We madea fucky wucky!! A wittle fucko boingo! " \
@borg.on(events.NewMessage) @borg.on(events.NewMessage)
async def on_pat(event): async def on_pat(event):
if event.forward: if event.fwd_from:
return return
user = borg.me.username user = borg.me.username

View File

@ -81,7 +81,7 @@ async def on_message(event):
@borg.on(events.NewMessage( @borg.on(events.NewMessage(
pattern=re.compile(r"^s/((?:\\/|[^/])+)/((?:\\/|[^/])*)(/.*)?"))) pattern=re.compile(r"^s/((?:\\/|[^/])+)/((?:\\/|[^/])*)(/.*)?")))
async def on_regex(event): async def on_regex(event):
if event.forward: if event.fwd_from:
return return
if not event.is_private and await group_has_sedbot(await event.input_chat): if not event.is_private and await group_has_sedbot(await event.input_chat):
return return

View File

@ -38,7 +38,7 @@ class Uniborg(TelegramClient):
# precedence # precedence
self._event_builders = hacks.ReverseList() self._event_builders = hacks.ReverseList()
self._loop.run_until_complete(self._async_init(bot_token=bot_token)) self.loop.run_until_complete(self._async_init(bot_token=bot_token))
core_plugin = Path(__file__).parent / "_core.py" core_plugin = Path(__file__).parent / "_core.py"
self.load_plugin_from_file(core_plugin) self.load_plugin_from_file(core_plugin)
@ -53,7 +53,7 @@ class Uniborg(TelegramClient):
self.uid = telethon.utils.get_peer_id(self.me) self.uid = telethon.utils.get_peer_id(self.me)
def run(self): def run(self):
self._loop.run_forever() self.loop.run_forever()
def load_plugin(self, shortname): def load_plugin(self, shortname):
self.load_plugin_from_file(f"{self._plugin_path}/{shortname}.py") self.load_plugin_from_file(f"{self._plugin_path}/{shortname}.py")