class sync_avatar: async def command(client, message): avatar_url = client.application.icon_url_as(ext='png', size=4096) if avatar_url is None: await client.message_create(message.channel, 'The application has no avatar set.') return async with client.http.get(avatar_url) as response: avatar = await response.read() await client.client_edit(avatar=avatar) await client.message_create(message.channel,'Avatar synced.') checks = checks.owner_only() async def description(command_context): return Embed('sync_avatar',( 'Hello there Esuto!\n' 'This is a specific command for You, to sync the bot\'s avatar with ' 'the application\'s. I know, You might struggle with updating the ' 'bot\'s avatar the other way, so I made a command for it.\n' 'Have a nice day!\n' f'Usage: `{command_context.prefix}sync_avatar`' ), color=COLOR__FLAN_HELP)
class shutdown: async def command(client, message): for client_ in CLIENTS.values(): await client_.disconnect() await client.message_create(message.channel, 'Clients stopped, stopping process.') KOKORO.stop() thread_id = main_thread().ident signal.pthread_kill(thread_id, signal.SIGKILL) category = 'UTILITY' checks = checks.owner_only() async def description(command_context): return Embed('shutdown', ('Shuts the clients down, then stops the process.' f'Usage `{command_context.prefix}shutdown`'), color=COLOR__SATORI_HELP).add_footer('Owner only!')
except ModuleNotFoundError: psutil = None from datetime import datetime from threading import enumerate as list_threads, _MainThread as MainThreadType from hata import EventThread, KOKORO, ExecutorThread, Client, Embed, Color, elapsed_time, Future, sleep from hata.ext.commands_v2 import checks from bot_utils.models import DB_ENGINE STAT_COLOR = Color.from_rgb(61, 255, 249) COMMAND_CLIENT: Client COMMAND_CLIENT.command_processor.create_category('STATS', checks=checks.owner_only()) @COMMAND_CLIENT.commands.from_class class threads: async def command(client, message): thread_count_by_type = {} thread_count = 0 for thread in list_threads(): thread_count += 1 thread_type = thread.__class__ thread_count_by_type[thread_type] = thread_count_by_type.get( thread_type, 0) + 1 description = []
from hata.discord.http import LIBRARY_USER_AGENT from hata.backend.headers import USER_AGENT, DATE from hata.ext.command_utils import wait_for_reaction, UserMenuFactory, UserPagination, WaitAndContinue from hata.ext.slash.menus import Pagination from hata.ext.commands_v2 import checks, cooldown, CommandCooldownError from hata.ext.commands_v2.helps.subterranean import SubterraneanHelpCommand from bot_utils.shared import COLOR__MARISA_HELP, \ command_error, GUILD__NEKO_DUNGEON, CHANNEL__NEKO_DUNGEON__DEFAULT_TEST, ROLE__NEKO_DUNGEON__TESTER from bot_utils.syncer import sync_request_command from bot_utils.interpreter_v2 import Interpreter from bot_utils.tools import choose, Cell Marisa : Client Marisa.command_processor.create_category('TEST COMMANDS', checks=checks.owner_only()) Marisa.command_processor.create_category('VOICE', checks=checks.guild_only()) Marisa.command_processor.get_default_category().checks = checks.owner_only() def marisa_help_embed_postprocessor(command_context, embed): if embed.color is None: embed.color = COLOR__MARISA_HELP embed.add_thumbnail(command_context.client.avatar_url) Marisa.commands(SubterraneanHelpCommand(embed_postprocessor=marisa_help_embed_postprocessor), name='help', category='HELP') @Marisa.command_processor.error async def command_error_handler(ctx, exception): if ctx.guild is not GUILD__NEKO_DUNGEON:
return Embed('shutdown', ('Shuts the clients down, then stops the process.' f'Usage `{command_context.prefix}shutdown`'), color=COLOR__SATORI_HELP).add_footer('Owner only!') async def execute_description(command_context): return Embed('execute', ('Use an interpreter trough me :3\n' 'Usages:\n' f'{command_context.prefix}execute # code goes here\n' '# code goes here\n' '# code goes here\n' '\n' f'{command_context.prefix}execute\n' '```\n' '# code goes here\n' '# code goes here\n' '```\n' '*not code*\n' '\n' '... and many more ways.'), color=COLOR__SATORI_HELP).add_footer('Owner only!') Satori.commands(Interpreter(locals().copy()), name='execute', description=execute_description, category='UTILITY', checks=[checks.owner_only()])
break await client.message_create(channel, text) async def channeling_stop_description(command_context): return Embed('channeling_stop', ( 'Cancels the channelling of this channel.\n' f'Usage: `{command_context.prefix}channeling_stop`\n' 'If more channels are connected, you need to call this command, ' 'from every of them, to cancel all.\n' 'If only one channel is left alone, it will be cancelled automatically.' ), color=CHANNELLER_COLOR).add_footer('Owner only!') COMMAND_CLIENT: Client COMMAND_CLIENT.commands( channeling_start, description=channeling_start_description, checks=[checks.guild_only(), checks.owner_only()], category='UTILITY', ) COMMAND_CLIENT.commands( channeling_stop, description=channeling_stop_description, checks=[checks.owner_only()], category='UTILITY', )