2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-30 14:08:31 +00:00

reduce stupid code

This commit is contained in:
Nick80835
2020-06-19 14:40:41 -04:00
parent d5c38de6bd
commit 1c6f9119e9
16 changed files with 20 additions and 45 deletions

View File

@@ -27,6 +27,8 @@ class MicroBot():
self.start_logger()
self.start_client()
self.start_loader()
def run_until_done(self):
self.loader.load_all_modules()
self.logger.info("Client successfully started.")
self.client.run_until_disconnected()
@@ -81,8 +83,10 @@ class MicroBot():
micro_bot = MicroBot()
micro_bot.start_microbot()
ldr = micro_bot.loader
try:
micro_bot.start_microbot()
micro_bot.run_until_done()
except:
micro_bot.client.loop.run_until_complete(micro_bot.stop_client())

View File

@@ -2,9 +2,7 @@
from random import choice, shuffle
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
BOARD_URL = "https://a.4cdn.org/{0}/threads.json"
POST_URL = "https://a.4cdn.org/{0}/thread/{1}.json"

View File

@@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
CAT_URL = 'http://api.thecatapi.com/v1/images/search'
DOG_URL = 'http://api.thedogapi.com/v1/images/search'

View File

@@ -2,9 +2,7 @@
from time import time_ns
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
DAN_URL = "http://danbooru.donmai.us/posts.json"
DAN_SAUCE_URL = "https://danbooru.donmai.us/posts/"

View File

@@ -31,9 +31,7 @@ from random import randint, uniform
from PIL import Image, ImageEnhance, ImageOps
from telethon.tl.types import DocumentAttributeFilename
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
@ldr.add("deepfry(f|)", userlocking=True)

View File

@@ -6,9 +6,7 @@ import io
from PIL import Image, ImageOps
from speedtest import Speedtest
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
@ldr.add("speed", owner=True, hide_help=True)

View File

@@ -3,9 +3,7 @@
from random import choice
from time import time_ns
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
GEL_URL = "https://gelbooru.com/index.php"
GEL_SAUCE_URL = "https://gelbooru.com/index.php?page=post&s=view&id="

View File

@@ -3,9 +3,7 @@
from asyncio import sleep
from random import choice, randint
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
emoji = list("😂😝🤪🤩😤🥵🤯🥶😱🤔😩🙄💀👻🤡😹👀👁👌💦🔥🌚🌝🌞🔫💯")
b_emoji = "🅱️"

View File

@@ -4,9 +4,7 @@ import io
from PIL import Image
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
NEKO_URL = "https://nekos.life/api/v2/img/"
NEKO_TYPES = ['neko', 'lewd', 'smug', 'tits', 'trap', 'anal', 'cuddle', 'hug', 'goose', 'waifu', 'gasm', 'slap', 'spank', 'pat', 'feet', 'woof', 'baka']

View File

@@ -6,9 +6,7 @@ from random import choice, shuffle
import praw
from prawcore import exceptions as redex
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
REDDIT = praw.Reddit(client_id='-fmzwojFG6JkGg',
client_secret=None,

View File

@@ -2,9 +2,7 @@
from time import time_ns
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
SAN_URL = "https://capi-v2.sankakucomplex.com/posts"
SAN_SAUCE_URL = "https://beta.sankakucomplex.com/post/show/"

View File

@@ -9,9 +9,8 @@ from gtts import gTTS
from howdoi import howdoi
from PIL import Image
from ubot.micro_bot import micro_bot
from ubot.micro_bot import ldr
ldr = micro_bot.loader
os.environ["HOWDOI_SEARCH_ENGINE"] = "bing"

View File

@@ -4,9 +4,7 @@ import io
from PIL import Image, ImageColor
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
@ldr.add("color")

View File

@@ -5,9 +5,7 @@ from platform import python_version
from telethon import version
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr, micro_bot
@ldr.add("reload", sudo=True, hide_help=True)

View File

@@ -4,9 +4,7 @@ from time import time_ns
from telethon import version
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
@ldr.add("del")

View File

@@ -2,9 +2,7 @@
import io
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
from ubot.micro_bot import ldr
UD_QUERY_URL = 'http://api.urbandictionary.com/v0/define'
UD_RANDOM_URL = 'http://api.urbandictionary.com/v0/random'