Skip to content

Commit

Permalink
Display ID and Type in note embed (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Mar 25, 2022
1 parent 1e18a1d commit 6ba3a29
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Hammer/CommandModules/Staff/StaffModule.ViewNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public async Task ViewNoteCommandAsync(CommandContext context,
string timestamp = Formatter.Timestamp(note.CreationTimestamp, TimestampFormat.ShortDateTime);

embed.WithAuthor(user);
embed.AddField(EmbedFieldNames.NoteID, note.Id, true);
embed.AddField(EmbedFieldNames.NoteType, note.Type.ToString("G"), true);
embed.AddField(EmbedFieldNames.Author, author.Mention, true);
embed.AddField(EmbedFieldNames.CreationTime, timestamp, true);
embed.AddField(EmbedFieldNames.Content, note.Content);
Expand Down
9 changes: 9 additions & 0 deletions Hammer/Resources/EmbedFieldNames.Designer.cs

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

3 changes: 3 additions & 0 deletions Hammer/Resources/EmbedFieldNames.resx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
<data name="NoteID" xml:space="preserve">
<value>__Note ID__</value>
</data>
<data name="NoteType" xml:space="preserve">
<value>__Note Type__</value>
</data>
<data name="MessageTime" xml:space="preserve">
<value>__Message Time__</value>
</data>
Expand Down
4 changes: 3 additions & 1 deletion Hammer/Services/MemberNoteService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
Expand All @@ -14,6 +14,7 @@
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SmartFormat;
using PermissionLevel = BrackeysBot.Core.API.PermissionLevel;

namespace Hammer.Services;
Expand Down Expand Up @@ -87,6 +88,7 @@ public async Task<MemberNote> CreateNoteAsync(DiscordUser user, DiscordMember au
DiscordEmbedBuilder embed = guild.CreateDefaultEmbed(false);
embed.WithTitle("Note Created");
embed.AddField(EmbedFieldNames.NoteID, note.Id, true);
embed.AddField(EmbedFieldNames.NoteType, note.Type.ToString("G"), true);
embed.AddField(EmbedFieldNames.User, user.Mention, true);
embed.AddField(EmbedFieldNames.Author, author.Mention, true);
embed.AddField(EmbedFieldNames.Content, note.Content);
Expand Down

0 comments on commit 6ba3a29

Please sign in to comment.