2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-28 13:08:42 +00:00

remove some shit/unused commands

This commit is contained in:
Nick80835 2021-07-11 12:54:19 -04:00
parent 52e26ab0dd
commit b048ffdc74
5 changed files with 0 additions and 205 deletions

View File

@ -6,12 +6,10 @@ asyncpraw
cchardet
cryptg
cython
gTTS
hachoir
peewee
pillow
psutil
speedtest-cli
telethon
ujson
Pafy

View File

@ -1,41 +1,10 @@
import io
from PIL import Image, ImageOps
from speedtest import Speedtest
from ubot import ldr
@ldr.add("speed", owner=True, hide_help=True)
async def iamspeed(event):
speed_message = await event.reply("Running speed test…")
test = Speedtest()
test.get_best_server()
test.download()
test.upload()
test.results.share()
result = test.results.dict()
await speed_message.edit(
f"**Started at:** {result['timestamp']}\n"
f"**Download:** {speed_convert(result['download'])}\n"
f"**Upload:** {speed_convert(result['upload'])}\n"
f"**Ping:** {result['ping']} milliseconds\n"
f"**ISP:** {result['client']['isp']}"
)
def speed_convert(size):
power = 2**10
zero = 0
units = {0: '', 1: 'Kilobits/s', 2: 'Megabits/s', 3: 'Gigabits/s', 4: 'Terabits/s'}
while size > power:
size /= power
zero += 1
return f"{round(size, 2)} {units[zero]}"
@ldr.add("chatid")
async def chatidgetter(event):
if event.is_reply:
@ -61,37 +30,6 @@ async def useridgetter(event):
await event.reply(f"**User ID:** {user_id}")
@ldr.add("profile")
async def userprofilegetter(event):
if event.args:
try:
user_entity = await event.client.get_entity(event.args)
except (ValueError, TypeError):
await event.reply("The ID or username you provided was invalid!")
return
elif event.is_reply:
reply = await event.get_reply_message()
reply_id = reply.sender_id
if reply_id:
try:
user_entity = await event.client.get_entity(reply_id)
except (ValueError, TypeError):
await event.reply("There was an error getting the user!")
return
else:
await event.reply("The user may have super sneaky privacy settings enabled!")
return
else:
await event.reply("Give me a user ID, username or reply!")
return
userid = user_entity.id
username = user_entity.username
userfullname = f"{user_entity.first_name} {user_entity.last_name or ''}"
await event.reply(f"**Full Name:** {userfullname}\n**Username:** @{username}\n**User ID:** {userid}")
@ldr.add("stickpng", help="Converts stickers to PNG files.")
async def stickertopng(event):
sticker = await event.get_sticker()
@ -171,39 +109,3 @@ def createstickersync(image_io):
sticker_new_io.seek(0)
return sticker_new_io
@ldr.add("compress")
async def compressor(event):
sticker = await event.get_sticker()
if not sticker:
await event.reply("Reply to a sticker to compress that bitch!")
return
try:
compression_quality = int(event.args)
if compression_quality < 0:
compression_quality = 0
elif compression_quality > 100:
compression_quality = 100
except ValueError:
compression_quality = 15
sticker_io = io.BytesIO()
await event.client.download_media(sticker, sticker_io)
await event.reply(file=await ldr.run_async(compressorsync, sticker_io, compression_quality))
def compressorsync(sticker_io, compression_quality):
sticker_image = Image.open(sticker_io)
sticker_image = sticker_image.convert("RGB")
sticker_io = io.BytesIO()
sticker_image.save(sticker_io, "JPEG", quality=compression_quality)
sticker_image = Image.open(sticker_io)
sticker_io = io.BytesIO()
sticker_image.save(sticker_io, "WebP", quality=99)
sticker_io.seek(0)
sticker_io.name = "sticker.webp"
return sticker_io

View File

@ -63,43 +63,16 @@ async def edit_message(event):
pass
@ldr.add("let the bodies hit the", simple_pattern=True, hide_help=True, fun=True)
async def floor(event):
if not event.args:
await event.reply("FLOOOOOOOOOOOOOOOOOOR")
@ldr.add("^bruh$", raw_pattern=True, hide_help=True, chance=15, fun=True)
async def bruh_moment(event):
await event.reply("moment")
@ldr.add("^ayaya$", raw_pattern=True, hide_help=True, fun=True)
async def ayaya(event):
await event.reply("AYAYA")
@ldr.add("^me too thanks$", raw_pattern=True, hide_help=True, fun=True)
async def me_too_thanks(event):
await event.respond("me too thanks")
@ldr.add("bab", hide_help=True, fun=True)
async def bab(event):
if event.is_reply:
await (await event.get_reply_message()).reply("You've been babbed!")
else:
await event.reply("Who am I supposed to bab?")
@ldr.add("unbab", hide_help=True, fun=True)
async def unbab(event):
if event.is_reply:
await (await event.get_reply_message()).reply("You've been unbabbed!")
else:
await event.reply("Who am I supposed to unbab?")
@ldr.add("(^| )moo( |$)", raw_pattern=True, hide_help=True, chance=25, fun=True)
async def moo(event):
await event.reply(choice(moo_answers))

View File

@ -54,18 +54,6 @@ async def vapor(event):
await event.reply(vapor_text)
@ldr.add("pop")
async def popifycmd(event):
text_arg, reply = await event.get_text(default=filler, return_msg=True)
pop_text = await popify(text_arg)
if reply:
await reply.reply(pop_text)
else:
await event.reply(pop_text)
@ldr.add("cheem")
async def cheemifycmd(event):
text_arg, reply = await event.get_text(default=filler, return_msg=True)
@ -102,23 +90,6 @@ async def owo(event):
await event.reply(owo_text)
@ldr.add("yoda")
async def yodafy(event):
text_arg, reply = await event.get_text(default=filler, return_msg=True)
async with ldr.aioclient.get("http://yoda-api.appspot.com/api/v1/yodish", params={"text": text_arg}) as response:
if response.status == 200:
yoda_text = (await response.json())["yodish"]
else:
await event.reply(f"An error occurred: **{response.status}**")
return
if reply:
await reply.reply(yoda_text)
else:
await event.reply(yoda_text)
async def shitpostify(text):
text = text.replace("dick", "peepee")
text = text.replace("ck", "cc")

View File

@ -2,7 +2,6 @@ import io
import re
import pafy
from gtts import gTTS
from PIL import Image
from ubot.fixes.fast_telethon import upload_file
@ -96,31 +95,6 @@ def pokemon_image_sync(sprite_io):
return sticker_io
@ldr.add("tts", help="Text to speech.")
async def text_to_speech(event):
text, reply = await event.get_text(return_msg=True)
if not text:
await event.reply("Give me text or reply to text to use TTS.")
return
tts_bytesio = io.BytesIO()
tts_bytesio.name = "tts.mp3"
try:
tts = gTTS(text, lang="EN")
tts.write_to_fp(tts_bytesio)
tts_bytesio.seek(0)
except AssertionError:
await event.reply('The text is empty.\nNothing left to speak after pre-precessing, tokenizing and cleaning.')
return
except RuntimeError:
await event.reply('Error loading the languages dictionary.')
return
await event.client.send_file(event.chat, file=tts_bytesio, voice_note=True, reply_to=reply)
@ldr.add("ip", help="IP lookup.")
async def ip_lookup(event):
ip = await event.get_text()
@ -243,26 +217,3 @@ async def youtube_cmd(event):
await event.reply(file=video_stream.url)
except:
await event.reply(f"Download failed, the video was probably over 20MB, use other bots for this shit: [URL]({video_stream.url})")
@ldr.add("yta", userlocking=True)
async def youtube_audio_cmd(event):
video = pafy.new(event.args)
audio_stream = video.getbestaudio(preftype="m4a")
try:
async with ldr.aioclient.get(audio_stream.url) as response:
if response.status == 200:
if int(response.headers["content-length"]) >= 20000000:
await event.reply("Fuck off.")
return
audio_data = io.BytesIO(await response.read())
audio_data.name = "audio.m4a"
else:
raise Exception
file_handle = await upload_file(event.client, audio_data)
await event.reply(file=file_handle)
except:
await event.reply(f"Download failed: [URL]({audio_stream.url})")