You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Migrate from joinwatch to notes
Deprecate joinwatch commands, add show on join/leave option to notes, migrate joinwatches to notes on bot startup
* Accept review suggestion
Co-authored-by: Erisa A <[email protected]>
* Do joinwatch migration in startup event, move to new Migrations namespace
Also try/catches migration to avoid crashing the bot in case migration fails
* Check whether joinwatches are present before attempting to migrate to notes
* Log error for failed joinwatch migrations
* Make joinwatch deprecation messages clearer, add note command examples
---------
Co-authored-by: Erisa A <[email protected]>
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Now watching for joins/leaves of {user.Mention} to send to the investigations channel"
49
-
+(note==""?"!":$" with the following note:\n>>> {note}"));
50
-
}
14
+
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Error} This command is deprecated and no longer works; all joinwatches have been converted to notes. Please use `/note add` instead, like this: `/note add user:{user.Id} note:{(string.IsNullOrEmpty(note)?"<context>":note)} show_on_join_and_leave:True`");
51
15
}
52
16
53
17
[SlashCommand("remove","Stop watching for joins and leaves of a user.")]
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Error} This command is deprecated and no longer works; all joinwatches have been converted to notes. Please use `/note delete` instead, like this: `/note delete user:{user.Id} note:<note>`");
69
22
}
70
23
71
24
[SlashCommand("status","Check the joinwatch status for a user.")]
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Information}{user.Mention} is currently being watched, but no note is set.");
83
-
else
84
-
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Information}{user.Mention} is currently being watched with the following note:\n> {note}");
85
-
}
86
-
else
87
-
{
88
-
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Error}{user.Mention} is not being watched!");
89
-
}
28
+
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Error} This command is deprecated and no longer works; all joinwatches have been converted to notes. Please use `/note list user:{user.Id}` to show all of this user's notes, or `/note details user:{user.Id} note:<note>` for details on a specific note, instead. Notes with \"Show on Join & Leave\" enabled will behave like joinwatches.");
Copy file name to clipboardExpand all lines: Commands/InteractionCommands/UserNoteInteractions.cs
+9-3Lines changed: 9 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,8 @@ public async Task AddUserNoteAsync(InteractionContext ctx,
15
15
[Option("show_on_modmail","Whether to show the note when the user opens a modmail thread. Default: true")]boolshowOnModmail=true,
16
16
[Option("show_on_warn","Whether to show the note when the user is warned. Default: true")]boolshowOnWarn=true,
17
17
[Option("show_all_mods","Whether to show this note to all mods, versus just yourself. Default: true")]boolshowAllMods=true,
18
-
[Option("show_once","Whether to show this note once and then discard it. Default: false")]boolshowOnce=false)
18
+
[Option("show_once","Whether to show this note once and then discard it. Default: false")]boolshowOnce=false,
19
+
[Option("show_on_join_and_leave","Whether to show this note when the user joins & leaves. Works like joinwatch. Default: false")]boolshowOnJoinAndLeave=false)
19
20
{
20
21
awaitctx.DeferAsync();
21
22
@@ -30,6 +31,7 @@ public async Task AddUserNoteAsync(InteractionContext ctx,
30
31
ShowOnWarn=showOnWarn,
31
32
ShowAllMods=showAllMods,
32
33
ShowOnce=showOnce,
34
+
ShowOnJoinAndLeave=showOnJoinAndLeave,
33
35
NoteId=noteId,
34
36
Timestamp=DateTime.Now,
35
37
Type=WarningType.Note
@@ -88,7 +90,8 @@ public async Task EditUserNoteAsync(InteractionContext ctx,
88
90
[Option("show_on_modmail","Whether to show the note when the user opens a modmail thread.")]bool?showOnModmail=null,
89
91
[Option("show_on_warn","Whether to show the note when the user is warned.")]bool?showOnWarn=null,
90
92
[Option("show_all_mods","Whether to show this note to all mods, versus just yourself.")]bool?showAllMods=null,
91
-
[Option("show_once","Whether to show this note once and then discard it.")]bool?showOnce=null)
93
+
[Option("show_once","Whether to show this note once and then discard it.")]bool?showOnce=null,
94
+
[Option("show_on_join_and_leave","Whether to show this note when the user joins & leaves. Works like joinwatch. Default: false")]bool?showOnJoinAndLeave=false)
92
95
{
93
96
// Get note
94
97
UserNotenote;
@@ -107,7 +110,7 @@ public async Task EditUserNoteAsync(InteractionContext ctx,
awaitctx.CreateResponseAsync(newDiscordInteractionResponseBuilder().WithContent($"{Program.cfgjson.Emoji.Error} You didn't change anything about the note!").AsEphemeral());
113
116
return;
@@ -129,6 +132,8 @@ public async Task EditUserNoteAsync(InteractionContext ctx,
129
132
showAllMods=note.ShowAllMods;
130
133
if(showOnceisnull)
131
134
showOnce=note.ShowOnce;
135
+
if(showOnJoinAndLeaveisnull)
136
+
showOnJoinAndLeave=note.ShowOnJoinAndLeave;
132
137
133
138
// Assemble new note
134
139
note.ModUserId=ctx.User.Id;
@@ -137,6 +142,7 @@ public async Task EditUserNoteAsync(InteractionContext ctx,
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Successfully updated the note for {user.Mention} (run again with no note to unwatch):\n> {note}");
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Now watching for joins/leaves of {user.Mention} to send to the investigations channel"
210
-
+(note==""?"!":$" with the following note:\n>>> {note}"));
211
-
}
176
+
awaitctx.RespondAsync($"{Program.cfgjson.Emoji.Error} This command is deprecated and no longer works; all joinwatches have been converted to notes. To add a note for this user, please use `/note add user:{user.Id} note:{(string.IsNullOrEmpty(note)?"<context>":note)} show_on_join_and_leave:True`; to remove one, use `/note delete user:{user.Id} note:<note>`.");
LogChannelHelper.LogMessageAsync("investigations",$"{cfgjson.Emoji.Warning}{e.Member.Mention} just joined the server with notes set to show on join!",notesEmbed);
LogChannelHelper.LogMessageAsync("investigations",$"{cfgjson.Emoji.Warning}{e.Member.Mention} just left the server with notes set to show on leave!",notesEmbed);
0 commit comments