Skip to content

Commit

Permalink
feat(admin): change log level from discord @natelandau (#113)
Browse files Browse the repository at this point in the history
* feat(admin): change log level from discord

* build(deps): update boto3

* feat(logging): increase chatter
  • Loading branch information
natelandau authored Jan 26, 2024
1 parent c547e8e commit d61bb41
Show file tree
Hide file tree
Showing 20 changed files with 195 additions and 135 deletions.
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions src/valentina/characters/chargen.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ async def random_attributes(self, character: Character) -> Character:
Args:
character (Character): The character for which to generate attributes.
"""
logger.debug(f"CHARGEN: Generate attribute values for {character.name}")
logger.debug(f"Generate attribute values for {character.name}")

concept = CharacterConcept[character.concept_name] if character.concept_name else None
char_class = CharClass[character.char_class_name]
Expand Down Expand Up @@ -591,7 +591,7 @@ async def random_abilities(self, character: Character) -> Character:
Args:
character (Character): The character for which to generate abilities.
"""
logger.debug(f"CHARGEN: Generate ability values for {character.name}")
logger.debug(f"Generate ability values for {character.name}")

concept = CharacterConcept[character.concept_name] if character.concept_name else None

Expand Down Expand Up @@ -656,7 +656,7 @@ async def random_disciplines(self, character: Character) -> Character:
Returns:
Character: The updated character.
"""
logger.debug(f"CHARGEN: Generate discipline values for {character.name}")
logger.debug(f"Generate discipline values for {character.name}")

# TODO: Work with Ghouls which have no clan
try:
Expand Down Expand Up @@ -713,7 +713,7 @@ async def random_virtues(self, character: Character) -> Character:
Returns:
Character: The updated character.
"""
logger.debug(f"CHARGEN: Generate virtue values for {character.name}")
logger.debug(f"Generate virtue values for {character.name}")

if not (
virtues := TraitCategory.VIRTUES.get_trait_list(CharClass[character.char_class_name])
Expand Down Expand Up @@ -756,7 +756,7 @@ async def random_backgrounds(self, character: Character) -> Character:
Returns:
Character: The updated character.
"""
logger.debug(f"CHARGEN: Generate background values for {character.name}")
logger.debug(f"Generate background values for {character.name}")

char_class = CharClass[character.char_class_name]

Expand Down Expand Up @@ -801,7 +801,7 @@ async def random_willpower(self, character: Character) -> Character: # noqa: PL
Returns:
Character: The updated character.
"""
logger.debug(f"CHARGEN: Generate willpower values for {character.name}")
logger.debug(f"Generate willpower values for {character.name}")

if not any(x.name for x in character.traits if x.name == "Self-Control"): # type: ignore [attr-defined]
return character
Expand Down Expand Up @@ -852,7 +852,7 @@ async def random_hunter_traits(self, character: Character) -> Character:
if character.char_class != CharClass.HUNTER:
return character

logger.debug(f"CHARGEN: Generate hunter trait values for {character.name}")
logger.debug(f"Generate hunter trait values for {character.name}")

try:
creed = HunterCreed[character.creed_name]
Expand Down Expand Up @@ -919,7 +919,7 @@ async def concept_special_abilities(self, character: Character) -> Character: #
if character.char_class != CharClass.MORTAL:
return character

logger.debug(f"CHARGEN: Assign special abilities for {character.name}")
logger.debug(f"Assign special abilities for {character.name}")

# Assign Traits
for ability in character.concept.value.abilities:
Expand Down Expand Up @@ -1055,7 +1055,7 @@ async def start(self, restart: bool = False) -> None:
Args:
restart (bool, optional): Whether to restart the wizard. Defaults to False.
"""
logger.debug("CHARGEN: Starting the character generation wizard.")
logger.debug("Starting the character generation wizard.")

# Build the instructional embeds
embed1 = discord.Embed(
Expand Down Expand Up @@ -1126,7 +1126,7 @@ async def present_character_choices(self) -> None:
Returns:
None: This method returns nothing.
"""
logger.debug("CHARGEN: Starting the character selection process")
logger.debug("Starting the character selection process")

# Generate 3 characters
characters = [
Expand Down Expand Up @@ -1192,7 +1192,7 @@ async def present_character_choices(self) -> None:
campaign_xp, _, _ = self.user.fetch_campaign_xp(self.campaign)

# Delete the previously created characters
logger.debug("CHARGEN: Rerolling characters and deleting old ones.")
logger.debug("Rerolling characters and deleting old ones.")
for character in characters:
await character.delete(link_rule=DeleteRules.DELETE_LINKS)

Expand Down Expand Up @@ -1271,7 +1271,7 @@ async def spend_freebie_points(self, character: Character) -> Character:
Returns:
Character: The created character.
"""
logger.debug(f"CHARGEN: Spending freebie points for {character.name}")
logger.debug(f"Spending freebie points for {character.name}")

# Create the character sheet embed
title = f"Spend freebie points on {character.name}\n"
Expand Down
5 changes: 3 additions & 2 deletions src/valentina/cogs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,16 @@ async def emoji_add(

# Confirm the action
title = f"Add custom emoji :{name}:"
is_confirmed, msg, confirmation_embed = await confirm_action(ctx, title, hidden=hidden)
is_confirmed, msg, confirmation_embed = await confirm_action(
ctx, title, hidden=hidden, audit=True
)
if not is_confirmed:
return

# Add the emoji
await ctx.guild.create_custom_emoji(name=name, image=data)

# Send confirmation
await ctx.post_to_audit_log(title)
await msg.edit_original_response(embed=confirmation_embed, view=None)

@guild.command(name="emoji_delete")
Expand Down
23 changes: 7 additions & 16 deletions src/valentina/cogs/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def create_campaign(

title = f"Create new campaign: `{name}`"
is_confirmed, interaction, confirmation_embed = await confirm_action(
ctx, title, hidden=hidden
ctx, title, hidden=hidden, audit=True
)

if not is_confirmed:
Expand All @@ -83,7 +83,6 @@ async def create_campaign(
guild.campaigns.append(campaign)
await guild.save()

await ctx.post_to_audit_log(title)
await interaction.edit_original_response(embed=confirmation_embed, view=None)

@campaign.command(name="current_date", description="Set the current date of a campaign")
Expand All @@ -103,7 +102,6 @@ async def current_date(
campaign.date_in_game = date
await campaign.save()

await ctx.post_to_audit_log(f"Set date of campaign `{campaign.name}` to `{date:%Y-%m-%d}`")
await present_embed(
ctx,
title=f"Set date of campaign `{campaign.name}` to `{date:%Y-%m-%d}`",
Expand Down Expand Up @@ -133,7 +131,7 @@ async def delete_campaign(

title = f"Delete campaign: {campaign.name}"
is_confirmed, interaction, confirmation_embed = await confirm_action(
ctx, title, hidden=hidden
ctx, title, hidden=hidden, audit=True
)

if not is_confirmed:
Expand All @@ -142,7 +140,6 @@ async def delete_campaign(
guild = await Guild.get(ctx.guild.id, fetch_links=True)
await guild.delete_campaign(campaign)

await ctx.post_to_audit_log(title)
await interaction.edit_original_response(embed=confirmation_embed, view=None)

@campaign.command(name="view", description="View a campaign")
Expand Down Expand Up @@ -207,7 +204,7 @@ async def campaign_set_active(

title = f"Set campaign `{campaign.name}` as active"
is_confirmed, interaction, confirmation_embed = await confirm_action(
ctx, title, hidden=hidden
ctx, title, hidden=hidden, audit=True
)

if not is_confirmed:
Expand All @@ -217,7 +214,6 @@ async def campaign_set_active(
guild.active_campaign = campaign
await guild.save()

await ctx.post_to_audit_log(title)
await interaction.edit_original_response(embed=confirmation_embed, view=None)

@campaign.command(name="set_inactive", description="Set a campaign as inactive")
Expand Down Expand Up @@ -248,7 +244,7 @@ async def campaign_set_inactive(

title = f"Set campaign `{active_campaign.name}` as inactive"
is_confirmed, interaction, confirmation_embed = await confirm_action(
ctx, title, hidden=hidden
ctx, title, hidden=hidden, audit=True
)

if not is_confirmed:
Expand All @@ -257,7 +253,6 @@ async def campaign_set_inactive(
guild.active_campaign = None
await guild.save()

await ctx.post_to_audit_log(title)
await interaction.edit_original_response(embed=confirmation_embed, view=None)

@campaign.command(name="list", description="List all campaigns")
Expand Down Expand Up @@ -294,7 +289,6 @@ async def campaign_list(
])

await present_embed(ctx, title="Campaigns", fields=fields, level="info")
logger.debug("CAMPAIGN: List all campaigns")

### NPC COMMANDS ####################################################################

Expand Down Expand Up @@ -476,7 +470,7 @@ async def delete_npc(

title = f"Delete NPC: `{npc.name}` in `{active_campaign.name}`"
is_confirmed, interaction, confirmation_embed = await confirm_action(
ctx, title, hidden=hidden
ctx, title, hidden=hidden, audit=True
)

if not is_confirmed:
Expand All @@ -485,7 +479,6 @@ async def delete_npc(
del active_campaign.npcs[index]
await active_campaign.save()

await ctx.post_to_audit_log(title)
await interaction.edit_original_response(embed=confirmation_embed, view=None)

### CHAPTER COMMANDS ####################################################################
Expand Down Expand Up @@ -641,7 +634,7 @@ async def delete_chapter(

title = f"Delete Chapter `{chapter.number}. {chapter.name}` from `{active_campaign.name}`"
is_confirmed, interaction, confirmation_embed = await confirm_action(
ctx, title, hidden=hidden
ctx, title, hidden=hidden, audit=True
)

if not is_confirmed:
Expand All @@ -650,7 +643,6 @@ async def delete_chapter(
del active_campaign.chapters[index]
await active_campaign.save()

await ctx.post_to_audit_log(title)
await interaction.edit_original_response(embed=confirmation_embed, view=None)

### NOTE COMMANDS ####################################################################
Expand Down Expand Up @@ -802,7 +794,7 @@ async def delete_note(

title = f"Delete note: `{note.name}` from `{active_campaign.name}`"
is_confirmed, interaction, confirmation_embed = await confirm_action(
ctx, title, hidden=hidden
ctx, title, hidden=hidden, audit=True
)

if not is_confirmed:
Expand All @@ -811,7 +803,6 @@ async def delete_note(
del active_campaign.notes[index]
await active_campaign.save()

await ctx.post_to_audit_log(title)
await interaction.edit_original_response(embed=confirmation_embed, view=None)


Expand Down
Loading

0 comments on commit d61bb41

Please sign in to comment.