(voice): Adjust now responses.
This commit is contained in:
@@ -5,7 +5,7 @@ import datetime as dt
|
|||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands as cmds
|
from discord.ext import commands as cmds
|
||||||
from discord import app_commands as appcmds
|
from discord import AllowedMentions, app_commands as appcmds
|
||||||
|
|
||||||
from data import Condition
|
from data import Condition
|
||||||
from meta import LionBot, LionCog, LionContext
|
from meta import LionBot, LionCog, LionContext
|
||||||
@@ -668,7 +668,7 @@ class VoiceTrackerCog(LionCog):
|
|||||||
@appcmds.describe(
|
@appcmds.describe(
|
||||||
tag=_p(
|
tag=_p(
|
||||||
'cmd:now|param:tag|desc',
|
'cmd:now|param:tag|desc',
|
||||||
"Describe what you are working on in 10 characters or less!"
|
"Describe what you are working!"
|
||||||
),
|
),
|
||||||
user=_p(
|
user=_p(
|
||||||
'cmd:now|param:user|desc',
|
'cmd:now|param:user|desc',
|
||||||
@@ -681,7 +681,8 @@ class VoiceTrackerCog(LionCog):
|
|||||||
)
|
)
|
||||||
@appcmds.guild_only
|
@appcmds.guild_only
|
||||||
async def now_cmd(self, ctx: LionContext,
|
async def now_cmd(self, ctx: LionContext,
|
||||||
tag: Optional[appcmds.Range[str, 0, 75]] = None,
|
tag: Optional[str] = None,
|
||||||
|
*,
|
||||||
user: Optional[discord.Member] = None,
|
user: Optional[discord.Member] = None,
|
||||||
clear: Optional[bool] = None
|
clear: Optional[bool] = None
|
||||||
):
|
):
|
||||||
@@ -720,87 +721,27 @@ class VoiceTrackerCog(LionCog):
|
|||||||
if target == ctx.author:
|
if target == ctx.author:
|
||||||
# Clear the author's tag
|
# Clear the author's tag
|
||||||
await session.set_tag(None)
|
await session.set_tag(None)
|
||||||
ack = discord.Embed(
|
ack = "Cleared your current task!"
|
||||||
colour=discord.Colour.brand_green(),
|
|
||||||
title=t(_p(
|
|
||||||
'cmd:now|target:self|mode:clear|success|title',
|
|
||||||
"Session Tag Cleared"
|
|
||||||
)),
|
|
||||||
description=t(_p(
|
|
||||||
'cmd:now|target:self|mode:clear|success|desc',
|
|
||||||
"Successfully unset your session tag."
|
|
||||||
))
|
|
||||||
)
|
|
||||||
elif not is_moderator:
|
elif not is_moderator:
|
||||||
# Trying to clear someone else's tag without being a moderator
|
# Trying to clear someone else's tag without being a moderator
|
||||||
ack = discord.Embed(
|
ack = "You need to be a moderator to set or clear someone else's task!"
|
||||||
colour=discord.Colour.brand_red(),
|
|
||||||
title=t(_p(
|
|
||||||
'cmd:now|target:other|mode:clear|error:perms|title',
|
|
||||||
"You can't do that!"
|
|
||||||
)),
|
|
||||||
description=t(_p(
|
|
||||||
'cmd:now|target:other|mode:clear|error:perms|desc',
|
|
||||||
"You need to be a moderator to set or clear someone else's session tag."
|
|
||||||
))
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# Clearing someone else's tag as a moderator
|
# Clearing someone else's tag as a moderator
|
||||||
await session.set_tag(None)
|
await session.set_tag(None)
|
||||||
ack = discord.Embed(
|
ack = f"Cleared {target}'s current task!"
|
||||||
colour=discord.Colour.brand_green(),
|
|
||||||
title=t(_p(
|
|
||||||
'cmd:now|target:other|mode:clear|success|title',
|
|
||||||
"Session Tag Cleared!"
|
|
||||||
)),
|
|
||||||
description=t(_p(
|
|
||||||
'cmd:now|target:other|mode:clear|success|desc',
|
|
||||||
"Cleared {target}'s session tag."
|
|
||||||
)).format(target=target.mention)
|
|
||||||
)
|
|
||||||
elif tag:
|
elif tag:
|
||||||
# Tag setting mode
|
# Tag setting mode
|
||||||
if target == ctx.author:
|
if target == ctx.author:
|
||||||
# Set the author's tag
|
# Set the author's tag
|
||||||
await session.set_tag(tag)
|
await session.set_tag(tag)
|
||||||
ack = discord.Embed(
|
ack = f"Set your current task to `{tag}`, good luck! <:goodluck:1266447460146876497>"
|
||||||
colour=discord.Colour.brand_green(),
|
|
||||||
title=t(_p(
|
|
||||||
'cmd:now|target:self|mode:set|success|title',
|
|
||||||
"Session Tag Set!"
|
|
||||||
)),
|
|
||||||
description=t(_p(
|
|
||||||
'cmd:now|target:self|mode:set|success|desc',
|
|
||||||
"You are now working on `{new_tag}`. Good luck!"
|
|
||||||
)).format(new_tag=tag)
|
|
||||||
)
|
|
||||||
elif not is_moderator:
|
elif not is_moderator:
|
||||||
# Trying the set someone else's tag without being a moderator
|
# Trying the set someone else's tag without being a moderator
|
||||||
ack = discord.Embed(
|
ack = "You need to be a moderator to set or clear someone else's task!"
|
||||||
colour=discord.Colour.brand_red(),
|
|
||||||
title=t(_p(
|
|
||||||
'cmd:now|target:other|mode:set|error:perms|title',
|
|
||||||
"You can't do that!"
|
|
||||||
)),
|
|
||||||
description=t(_p(
|
|
||||||
'cmd:now|target:other|mode:set|error:perms|desc',
|
|
||||||
"You need to be a moderator to set or clear someone else's session tag!"
|
|
||||||
))
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# Setting someone else's tag as a moderator
|
# Setting someone else's tag as a moderator
|
||||||
await session.set_tag(tag)
|
await session.set_tag(tag)
|
||||||
ack = discord.Embed(
|
ack = f"Set {target}'s current task to `{tag}`"
|
||||||
colour=discord.Colour.brand_green(),
|
|
||||||
title=t(_p(
|
|
||||||
'cmd:now|target:other|mode:set|success|title',
|
|
||||||
"Session Tag Set!"
|
|
||||||
)),
|
|
||||||
description=t(_p(
|
|
||||||
'cmd:now|target:other|mode:set|success|desc',
|
|
||||||
"Set {target}'s session tag to `{new_tag}`."
|
|
||||||
)).format(target=target.mention, new_tag=tag)
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# Display tag and voice time
|
# Display tag and voice time
|
||||||
if target == ctx.author:
|
if target == ctx.author:
|
||||||
@@ -812,14 +753,14 @@ class VoiceTrackerCog(LionCog):
|
|||||||
else:
|
else:
|
||||||
desc = t(_p(
|
desc = t(_p(
|
||||||
'cmd:now|target:self|mode:show_without_tag|desc',
|
'cmd:now|target:self|mode:show_without_tag|desc',
|
||||||
"You have been working in {channel} since {time}!\n\n"
|
"You have been working in {channel} since {time}! "
|
||||||
"Use `/now <tag>` to set what you are working on."
|
"Use `/now <tag>` to set what you are working on."
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
if session.tag:
|
if session.tag:
|
||||||
desc = t(_p(
|
desc = t(_p(
|
||||||
'cmd:now|target:other|mode:show_with_tag|desc',
|
'cmd:now|target:other|mode:show_with_tag|desc',
|
||||||
"{target} is current working in {channel}!\n"
|
"{target} is current working in {channel}! "
|
||||||
"They have been working on **{tag}** since {time}."
|
"They have been working on **{tag}** since {time}."
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
@@ -827,18 +768,13 @@ class VoiceTrackerCog(LionCog):
|
|||||||
'cmd:now|target:other|mode:show_without_tag|desc',
|
'cmd:now|target:other|mode:show_without_tag|desc',
|
||||||
"{target} has been working in {channel} since {time}!"
|
"{target} has been working in {channel} since {time}!"
|
||||||
))
|
))
|
||||||
desc = desc.format(
|
ack = desc.format(
|
||||||
tag=session.tag,
|
tag=session.tag,
|
||||||
channel=f"<#{session.state.channelid}>",
|
channel=f"<#{session.state.channelid}>",
|
||||||
time=discord.utils.format_dt(session.start_time, 't'),
|
time=discord.utils.format_dt(session.start_time, 'R'),
|
||||||
target=target.mention,
|
target=target.mention,
|
||||||
)
|
)
|
||||||
ack = discord.Embed(
|
await ctx.reply(ack, allowed_mentions=AllowedMentions.none())
|
||||||
colour=discord.Colour.orange(),
|
|
||||||
description=desc,
|
|
||||||
timestamp=utc_now()
|
|
||||||
)
|
|
||||||
await ctx.reply(embed=ack)
|
|
||||||
|
|
||||||
# ----- Configuration Commands -----
|
# ----- Configuration Commands -----
|
||||||
@LionCog.placeholder_group
|
@LionCog.placeholder_group
|
||||||
|
|||||||
Reference in New Issue
Block a user