2
0
mirror of https://github.com/Nick80835/microbot synced 2025-09-05 00:45:55 +00:00

yeet the fucking fuck

This commit is contained in:
Nick80835
2020-10-01 20:55:46 -04:00
parent 9f07373b90
commit 24fe1b318e
5 changed files with 17 additions and 17 deletions

View File

@@ -3,7 +3,6 @@ aiofiles
aiohttp[speedups]
asyncpraw
cchardet
cryptg
gTTS
hachoir
howdoi
@@ -11,6 +10,7 @@ pillow
psutil
speedtest-cli
sqlalchemy
telethon
tgcrypto
Pafy
youtube-dl
https://github.com/Nick80835/Telethon/archive/master.zip

View File

@@ -47,8 +47,8 @@ class CommandHandler():
event.command = pattern_match.groups()[1]
if event.command in self.loader.db.get_disabled_commands(event.chat.id):
print(f"Attempted command ({event.raw_text}) in chat which disabled it ({event.chat.id}) from ID {event.from_id}")
if event.chat and not command.not_disableable and event.command in self.loader.db.get_disabled_commands(event.chat.id):
print(f"Attempted command ({event.raw_text}) in chat which disabled it ({event.chat.id}) from ID {event.sender_id}")
return
event.pattern_match = pattern_match
@@ -64,7 +64,7 @@ class CommandHandler():
pattern_match = search(self.inline_pattern_template.format(command.pattern + command.pattern_extra), event.text)
if pattern_match:
if self.is_blacklisted(event, True):
if self.is_blacklisted(event, True) and not self.is_owner(event) and not self.is_sudo(event):
print(f"Attempted command ({event.text}) from blacklisted ID {event.from_id}")
return
@@ -75,7 +75,7 @@ class CommandHandler():
pattern_match = search(self.inline_pattern_template.format(command.pattern + command.pattern_extra), event.text)
if pattern_match:
if self.is_blacklisted(event, True):
if self.is_blacklisted(event, True) and not self.is_owner(event) and not self.is_sudo(event):
print(f"Attempted command ({event.text}) from blacklisted ID {event.from_id}")
return
@@ -222,27 +222,27 @@ class CommandHandler():
print(f"Attempted sudo command ({event.raw_text}) from ID {event.from_id}")
return False
if command.admin and not await self.is_admin(event) and not self.is_sudo(event) and not self.is_owner(event):
if not event.chat and command.admin or event.chat and command.admin and not await self.is_admin(event) and not self.is_sudo(event) and not self.is_owner(event):
await event.reply("You lack the permissions to use that command!")
print(f"Attempted admin command ({event.raw_text}) from ID {event.from_id}")
return False
if command.nsfw and str(event.chat.id) in self.settings.get_list("nsfw_blacklist"):
if event.chat and command.nsfw and str(event.chat.id) in self.settings.get_list("nsfw_blacklist"):
await event.reply("NSFW commands are disabled in this chat!")
print(f"Attempted NSFW command ({event.raw_text}) in blacklisted chat ({event.chat.id}) from ID {event.from_id}")
return False
if command.fun and str(event.chat.id) in self.settings.get_list("fun_blacklist"):
if event.chat and command.fun and str(event.chat.id) in self.settings.get_list("fun_blacklist"):
print(f"Attempted fun command ({event.raw_text}) in blacklisted chat ({event.chat.id}) from ID {event.from_id}")
return False
return True
def is_owner(self, event):
return bool(str(event.from_id) in self.settings.get_list("owner_id"))
return bool(str(event.sender_id) in self.settings.get_list("owner_id"))
def is_sudo(self, event):
return bool(str(event.from_id) in self.settings.get_list("sudo_users"))
return bool(str(event.sender_id) in self.settings.get_list("sudo_users"))
async def is_admin(self, event):
if event.is_private:
@@ -255,6 +255,6 @@ class CommandHandler():
if inline:
user_id = event.query.user_id
else:
user_id = event.from_id
user_id = event.sender_id
return bool(str(user_id) in self.settings.get_list("blacklisted_users"))

View File

@@ -31,7 +31,7 @@ async def supernekoatsume(event):
return
try:
await event.client.send_file(event.chat_id, file=image_url, force_document=as_file, reply_to=reply_to)
await event.client.send_file(event.peer_id, file=image_url, force_document=as_file, reply_to=reply_to)
except:
await event.reply(f"Failed to fetch media for query: **{nekotype}**")

View File

@@ -126,7 +126,7 @@ async def text_to_speech(event):
await event.reply('Error loading the languages dictionary.')
return
await event.client.send_file(event.chat_id, tts_bytesio, voice_note=True, reply_to=reply)
await event.client.send_file(event.peer_id, tts_bytesio, voice_note=True, reply_to=reply)
@ldr.add("ip", help="IP lookup.")
@@ -258,7 +258,7 @@ async def youtube_cmd(event):
wait_msg = await event.reply(f"Large file detected ({int(file_size / 1000000)}MB), this may take some time…")
start_time = time_ns()
file_path = await download(video_stream.url, f"{event.chat_id}_{event.id}", ldr.aioclient)
file_path = await download(video_stream.url, f"{event.sender_id}_{event.id}", ldr.aioclient)
end_time = time_ns()
time_taken_seconds = int((end_time - start_time) / 1000000000) or 1

View File

@@ -29,4 +29,4 @@ async def stickcolor(event):
await event.reply(file=image_stream)
if event.args == "black":
await event.client.send_message(event.chat_id, "Racism is no more!")
await event.client.send_message(event.peer_id, "Racism is no more!")