class rules: async def command(client, message): embed = Embed( f'Rules of {DUNGEON}:', color=KOISHI_HELP_COLOR, ).add_field( 'Guidelines', 'Follow [Discord\'s guidelines](https://discord.com/guidelines)', ).add_field( 'Behaviour', 'Listen to staff and follow their instructions.', ).add_field( 'Language', f'{DUNGEON} is an english speaking server, please try to stick yourself to it.', ).add_field( 'Channels', 'Read the channel\'s topics. Make sure to keep the conversations in their respective channels.' ).add_field( 'Usernames', 'Invisible, offensive or noise unicode names are not allowed.' ).add_field( 'Spamming', 'Forbidden in any form. Spamming server members in DM-s counts as well.', ).add_field( 'NSFW', 'Keep explicit content in nsfw channels', ).add_field( 'Roles', f'Do not beg for roles. You can claim {EVERYNYAN_ROLE.mention} role, what gives you access to ' f'additional channels by typing `nya` at {WELCOME_CHANNEL.mention}.\n' f'*You must be the member of the guild for at least 10 minutes and {client.mention} must be online ' f'as well.*' '\n\n' f'Addtionally you can also claim (or unclaim) {ANNOUNCEMNETS_ROLE.mention} by typing `i meow` ' '(or `i not meow`), or if you are the member of the server for at least half year, you can claim the ' f'superior {WORSHIPPER_ROLE.mention} role by typing `nekogirl`!' ).add_field( 'Advertisements', 'Advertising other social medias, servers, communities or services in chat or in DM-s are disallowed.' ).add_field( 'No political or religious topics.', 'I do not say either that aliens exists, even tho they do.', ) await client.message_create(message.channel, embed=embed, allowed_mentions=None) if message.channel.cached_permissions_for(client).can_manage_messages: await client.message_delete(message) category = 'HELP' checks = [checks.owner_only(), checks.is_guild(DUNGEON)] async def description(client, message): prefix = client.command_processer.get_prefix_for(message) return Embed('rules', (f'Shows the rules of the {DUNGEON} guild.' f'Usage : `{prefix}rules`'), color=KOISHI_HELP_COLOR).add_footer( f'Owner only and can be used only at {DUNGEON}.')
def setup(lib): if IS_UNIX: CGROUP_PIDS_PARENT.mkdir(parents=True, exist_ok=True) CGROUP_MEMORY_PARENT.mkdir(parents=True, exist_ok=True) SNEKBOXING_PATH.mkdir(parents=True, exist_ok=True) try: (CGROUP_MEMORY_PARENT / 'memory.limit_in_bytes').write_text( str(MEM_MAX), encoding='utf-8') except PermissionError: pass else: try: (CGROUP_MEMORY_PARENT / 'memory.memsw.limit_in_bytes').write_text(str(MEM_MAX), encoding='utf-8') except PermissionError: # sys.stderr.write(f'From {__file__}: Failed to setup memory swap limit\n') pass main_client.command_processer.create_category( 'SNEKBOX', checks=[checks.is_guild(DUNGEON)]) main_client.commands.extend(SNEKBOX_COMMANDS)
return matched = _KOISHI_OWO_RP.fullmatch(content, ) if (matched is not None): text = f'{content[0].upper()}{content[1].lower()}{content[2].upper()}' elif (_KOISHI_OMAE_RP.match(content) is not None): text = 'NANI?' else: return await client.message_create(message.channel, text) Koishi.commands(command_error, checks=[checks.is_guild(DUNGEON)]) @Koishi.commands async def invalid_command(client, message, command, content): prefix = client.command_processer.get_prefix_for(message) embed = Embed( f'Invalid command `{command}`', f'try using: `{prefix}help`', color=KOISHI_HELP_COLOR, ) message = await client.message_create(message.channel, embed=embed) await sleep(30., KOKORO) await client.message_delete(message)
await voice_client.disconnect() text = f'{client.name_at(message.channel.guild)} out.' await client.message_create(message.channel, text) if AUDIO_PLAY_POSSIBLE: async def yt_play_description(client, message): prefix = client.command_processer.get_prefix_for(message) return Embed('play',( 'Do you want me to search me some audio to listen to?.\n' f'Usage: `{prefix}play <name>`\n' 'If you do not say anything to play, I ll tell, want I am currently playing instead > <.' ), color=MAIN_VOICE_COLOR) @VOICE_COMMANDS_MAIN(description=yt_play_description, name='play', checks=[checks.is_guild(DUNGEON)]) async def yt_play(client, message, content): while True: if YTAudio is None: text = 'This option in unavailable :c' break voice_client=client.voice_client_for(message) if voice_client is None: text='There is no voice client at your guild' break if not content: if voice_client.player is None: text = 'Nothing is playing now Good Sir!'
from bot_utils.syncer import sync_request_comamnd from bot_utils.interpreter import Interpreter setup_ext_commands(Marisa, MARISA_PREFIX, default_category_name=DEFAULT_CATEGORY_NAME, category_name_rule=category_name_rule) Marisa.command_processer.create_category('TEST COMMANDS', checks=[checks.owner_only()]) Marisa.commands(SubterraneanHelpCommand(MARISA_HELP_COLOR), 'help', category='HELP') Marisa.commands(command_error, checks=[checks.is_guild(DUNGEON)]) @Marisa.events async def ready(client): sys.stdout.write(f'{client:f} logged in.\n') async def execute_description(client, message): prefix = client.command_processer.get_prefix_for(message) return Embed('execute', ('Use an interpreter trough me :3\n' 'Usages:\n' f'{prefix}execute # code goes here\n' '# code goes here\n' '# code goes here\n' '\n'