Added presence command #18 #126

Merged
edraft merged 2 commits from #18 into 0.3 2022-11-20 15:41:26 +01:00
Showing only changes of commit 7fb6d22c3f - Show all commits

View File

@ -29,18 +29,20 @@ class PresenceCommand(DiscordCommandABC):
@commands.hybrid_command()
@commands.guild_only()
@CommandChecks.check_is_ready()
@CommandChecks.check_is_member_technician()
@CommandChecks.check_is_member_moderator()
Ebola-Chan marked this conversation as resolved Outdated

Moderator nicht Techniker

Moderator nicht Techniker

Hatten wir das nicht besprochen dass nur wir die Presence setzen sollen, da diese Global ist?

Hatten wir das nicht besprochen dass nur wir die Presence setzen sollen, da diese Global ist?

War ein aspekt aber mir solls egal sein, zu mal das nicht im Issue geändert wurde.

War ein aspekt aber mir solls egal sein, zu mal das nicht im Issue geändert wurde.
async def presence(self, ctx: Context, text: str = ''):
self._logger.debug(__name__, f'Received command presence {ctx}')
if text == '':
Ebola-Chan marked this conversation as resolved
Review

early returns pls:

if text == '':
    await self._bot.change_presence(activity=None)
    await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.removed'))
    return

if len(text) > 128:
	await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.max_char_count_exceeded'))
	return

await self._bot.change_presence(activity=discord.Game(name=text))
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.changed'))

early returns pls: ```py if text == '': await self._bot.change_presence(activity=None) await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.removed')) return if len(text) > 128: await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.max_char_count_exceeded')) return await self._bot.change_presence(activity=discord.Game(name=text)) await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.changed')) ```
await self._bot.change_presence(activity=None)
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.removed'))
else:
if len(text) > 128:
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.max_char_count_exceeded'))
else:
await self._bot.change_presence(activity=discord.Game(name=text))
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.changed'))
return
if len(text) > 128:
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.max_char_count_exceeded'))
return
await self._bot.change_presence(activity=discord.Game(name=text))
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.presence.changed'))
self._logger.trace(__name__, f'Finished presence command')