Skip to content

Commit 830cb7c

Browse files
committed
automated doc comment cleanup
1 parent 471a4a8 commit 830cb7c

11 files changed

+88
-260
lines changed

CommandData.cs

+4-12
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,16 @@
55

66
namespace DiscordBotBase
77
{
8-
/// <summary>
9-
/// All data related to a user command.
10-
/// </summary>
8+
/// <summary>All data related to a user command.</summary>
119
public class CommandData
1210
{
13-
/// <summary>
14-
/// The original Discord message.
15-
/// </summary>
11+
/// <summary>The original Discord message.</summary>
1612
public IUserMessage Message;
1713

18-
/// <summary>
19-
/// The raw argument text, split by spaces, after the command base. Includes pings and other data.
20-
/// </summary>
14+
/// <summary>The raw argument text, split by spaces, after the command base. Includes pings and other data.</summary>
2115
public string[] RawArguments;
2216

23-
/// <summary>
24-
/// The raw argument text, split by spaces, after the command base. Excludes pings or other special ignorable formats.
25-
/// </summary>
17+
/// <summary>The raw argument text, split by spaces, after the command base. Excludes pings or other special ignorable formats.</summary>
2618
public string[] CleanedArguments;
2719

2820
/// <summary>

CommandHandlers/CoreCommands.cs

+4-12
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,19 @@
88

99
namespace DiscordBotBase.CommandHandlers
1010
{
11-
/// <summary>
12-
/// Commands that most bots need.
13-
/// </summary>
11+
/// <summary>Commands that most bots need.</summary>
1412
public class CoreCommands : UserCommands
1513
{
16-
/// <summary>
17-
/// Constructs the core commands helper.
18-
/// </summary>
14+
/// <summary>Constructs the core commands helper.</summary>
1915
public CoreCommands(Func<IUser, bool> isUserAdmin)
2016
{
2117
UserAdminCheckMethod = isUserAdmin;
2218
}
2319

24-
/// <summary>
25-
/// Method to check if the user is an admin.
26-
/// </summary>
20+
/// <summary>Method to check if the user is an admin.</summary>
2721
public Func<IUser, bool> UserAdminCheckMethod;
2822

29-
/// <summary>
30-
/// Bot restart admin command.
31-
/// </summary>
23+
/// <summary>Bot restart admin command.</summary>
3224
public void CMD_Restart(CommandData command)
3325
{
3426
if (!UserAdminCheckMethod(command.Message.Author))

CommandHandlers/UserCommands.cs

+14-42
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,22 @@
1010

1111
namespace DiscordBotBase.CommandHandlers
1212
{
13-
/// <summary>
14-
/// Abstract base class for commands that users can run.
15-
/// </summary>
13+
/// <summary>Abstract base class for commands that users can run.</summary>
1614
public abstract class UserCommands
1715
{
18-
/// <summary>
19-
/// Prefix for when the bot successfully handles user input.
20-
/// </summary>
16+
/// <summary>Prefix for when the bot successfully handles user input.</summary>
2117
public const string SUCCESS_PREFIX = "+++ ";
2218

23-
/// <summary>
24-
/// Prefix for when the bot refuses user input.
25-
/// </summary>
19+
/// <summary>Prefix for when the bot refuses user input.</summary>
2620
public const string REFUSAL_PREFIX = "--- ";
2721

28-
/// <summary>
29-
/// The backing bot instance.
30-
/// </summary>
22+
/// <summary>The backing bot instance.</summary>
3123
public DiscordBot Bot;
3224

33-
/// <summary>
34-
/// Helper value to avoid sending a Discord reply to the same message twice in a row.
35-
/// </summary>
25+
/// <summary>Helper value to avoid sending a Discord reply to the same message twice in a row.</summary>
3626
public static ulong LastRepliedMessage;
3727

38-
/// <summary>
39-
/// Sends a reply to a message in the same channel.
40-
/// </summary>
28+
/// <summary>Sends a reply to a message in the same channel.</summary>
4129
/// <param name="message">The message to reply to.</param>
4230
/// <param name="embed">The embed message to send.</param>
4331
/// <param name="channelBackup">Optional backup channel if <paramref name="message"/> is null.</param>
@@ -72,49 +60,37 @@ public static IUserMessage SendDidYouMeanReply(IUserMessage message, string titl
7260
return sentMessage;
7361
}
7462

75-
/// <summary>
76-
/// Sends a generic positive reply to a message in the same channel.
77-
/// </summary>
63+
/// <summary>Sends a generic positive reply to a message in the same channel.</summary>
7864
public static IUserMessage SendGenericPositiveMessageReply(IUserMessage message, string title, string description, IMessageChannel channelBackup = null)
7965
{
8066
return SendReply(message, GetGenericPositiveMessageEmbed(title, description), channelBackup);
8167
}
8268

83-
/// <summary>
84-
/// Sends a generic negative reply to a message in the same channel.
85-
/// </summary>
69+
/// <summary>Sends a generic negative reply to a message in the same channel.</summary>
8670
public static IUserMessage SendGenericNegativeMessageReply(IUserMessage message, string title, string description, IMessageChannel channelBackup = null)
8771
{
8872
return SendReply(message, GetGenericNegativeMessageEmbed(title, description), channelBackup);
8973
}
9074

91-
/// <summary>
92-
/// Sends an error message reply to a message in the same channel.
93-
/// </summary>
75+
/// <summary>Sends an error message reply to a message in the same channel.</summary>
9476
public static IUserMessage SendErrorMessageReply(IUserMessage message, string title, string description, IMessageChannel channelBackup = null)
9577
{
9678
return SendReply(message, GetErrorMessageEmbed(title, description), channelBackup);
9779
}
9880

99-
/// <summary>
100-
/// Creates an Embed object for a generic positive message.
101-
/// </summary>
81+
/// <summary>Creates an Embed object for a generic positive message.</summary>
10282
public static Embed GetGenericPositiveMessageEmbed(string title, string description)
10383
{
10484
return new EmbedBuilder().WithTitle(title).WithColor(0, 255, 255).WithDescription(description).Build();
10585
}
10686

107-
/// <summary>
108-
/// Creates an Embed object for a generic negative message.
109-
/// </summary>
87+
/// <summary>Creates an Embed object for a generic negative message.</summary>
11088
public static Embed GetGenericNegativeMessageEmbed(string title, string description)
11189
{
11290
return new EmbedBuilder().WithTitle(title).WithColor(255, 128, 0).WithDescription(description).Build();
11391
}
11492

115-
/// <summary>
116-
/// Creates an Embed object for an error message.
117-
/// </summary>
93+
/// <summary>Creates an Embed object for an error message.</summary>
11894
public static Embed GetErrorMessageEmbed(string title, string description)
11995
{
12096
return new EmbedBuilder().WithTitle(title).WithColor(255, 64, 32).WithThumbnailUrl(Constants.WARNING_ICON).WithDescription(description).Build();
@@ -132,9 +108,7 @@ private static string ReplaceIfMultiple(string text, char c, char replacement)
132108
return text;
133109
}
134110

135-
/// <summary>
136-
/// Escapes user input for output. Best when wrapped in `backticks`.
137-
/// </summary>
111+
/// <summary>Escapes user input for output. Best when wrapped in `backticks`.</summary>
138112
/// <param name="text">The user input text.</param>
139113
/// <returns>The escaped result.</returns>
140114
public static string EscapeUserInput(string text)
@@ -163,9 +137,7 @@ public static string EscapeUserInput(string text)
163137
return text;
164138
}
165139

166-
/// <summary>
167-
/// Generates a link to a Discord message.
168-
/// </summary>
140+
/// <summary>Generates a link to a Discord message.</summary>
169141
public static string LinkToMessage(IMessage message)
170142
{
171143
return "https://discordapp.com/channels/" + (message.Channel as SocketGuildChannel).Guild.Id + "/" + message.Channel.Id + "/" + message.Id;

ConnectionMonitor.cs

+14-42
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,25 @@
1616

1717
namespace DiscordBotBase
1818
{
19-
/// <summary>
20-
/// Helper to monitor a Discord bot's connectivity.
21-
/// </summary>
19+
/// <summary>Helper to monitor a Discord bot's connectivity.</summary>
2220
public class ConnectionMonitor
2321
{
24-
/// <summary>
25-
/// The bot to monitor.
26-
/// </summary>
22+
/// <summary>The bot to monitor.</summary>
2723
public DiscordBot Bot;
2824

29-
/// <summary>
30-
/// Initializes the connection monitor. Call <see cref="StartMonitorLoop"/> to start the monitor loop.
31-
/// </summary>
25+
/// <summary>Initializes the connection monitor. Call <see cref="StartMonitorLoop"/> to start the monitor loop.</summary>
3226
public ConnectionMonitor(DiscordBot bot)
3327
{
3428
Bot = bot;
3529
}
3630

37-
/// <summary>
38-
/// Whether the bot has ever connected to Discord (since this instance of the class was started).
39-
/// </summary>
31+
/// <summary>Whether the bot has ever connected to Discord (since this instance of the class was started).</summary>
4032
public bool ConnectedOnce = false;
4133

42-
/// <summary>
43-
/// Whether the bot believes itself to be currently connected to Discord. (If false, the bot is preparing or running a reconnection cycle).
44-
/// </summary>
34+
/// <summary>Whether the bot believes itself to be currently connected to Discord. (If false, the bot is preparing or running a reconnection cycle).</summary>
4535
public bool ConnectedCurrently = false;
4636

47-
/// <summary>
48-
/// Timespan the monitor should delay between connectivity checks.
49-
/// </summary>
37+
/// <summary>Timespan the monitor should delay between connectivity checks.</summary>
5038
public TimeSpan MonitorLoopTime = new(hours: 0, minutes: 1, seconds: 0);
5139

5240
/// <summary>
@@ -61,9 +49,7 @@ public ConnectionMonitor(DiscordBot bot)
6149
/// </summary>
6250
public bool StopAllLogic = false;
6351

64-
/// <summary>
65-
/// Whether all new bot logic should be stopped (usually indicates that a new bot instance is taking over).
66-
/// </summary>
52+
/// <summary>Whether all new bot logic should be stopped (usually indicates that a new bot instance is taking over).</summary>
6753
public bool ShouldStopAllLogic()
6854
{
6955
lock (MonitorLock)
@@ -72,9 +58,7 @@ public bool ShouldStopAllLogic()
7258
}
7359
}
7460

75-
/// <summary>
76-
/// Restarts the bot.
77-
/// </summary>
61+
/// <summary>Restarts the bot.</summary>
7862
public void ForceRestartBot()
7963
{
8064
lock (MonitorLock)
@@ -88,33 +72,23 @@ public void ForceRestartBot()
8872
DiscordBotBaseHelper.LaunchBotThread(Array.Empty<string>(), Bot.ClientConfig);
8973
}
9074

91-
/// <summary>
92-
/// Lock object for monitor variables.
93-
/// </summary>
75+
/// <summary>Lock object for monitor variables.</summary>
9476
public LockObject MonitorLock = new();
9577

96-
/// <summary>
97-
/// The number of monitor loops thus far that the bot has not received input.
98-
/// </summary>
78+
/// <summary>The number of monitor loops thus far that the bot has not received input.</summary>
9979
public long LoopsSilent = 0;
10080

101-
/// <summary>
102-
/// The number of monitor loops thus far that the bot has been active for.
103-
/// </summary>
81+
/// <summary>The number of monitor loops thus far that the bot has been active for.</summary>
10482
public long LoopsTotal = 0;
10583

106-
/// <summary>
107-
/// Starts the monitor loop thread.
108-
/// </summary>
84+
/// <summary>Starts the monitor loop thread.</summary>
10985
public void StartMonitorLoop()
11086
{
11187
Thread thr = new(new ThreadStart(LoopUntilFail)) { Name = "discordbotconnectionmonitor" };
11288
thr.Start();
11389
}
11490

115-
/// <summary>
116-
/// Loops the monitor until the bot has disconnected.
117-
/// </summary>
91+
/// <summary>Loops the monitor until the bot has disconnected.</summary>
11892
public void LoopUntilFail()
11993
{
12094
while (true)
@@ -139,9 +113,7 @@ public void LoopUntilFail()
139113
}
140114
}
141115

142-
/// <summary>
143-
/// Internal loop method (ran by a separate looping thread handler) for the monitor.
144-
/// </summary>
116+
/// <summary>Internal loop method (ran by a separate looping thread handler) for the monitor.</summary>
145117
public void MonitorLoopOnce()
146118
{
147119
bool isConnected;

Constants.cs

+6-18
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,22 @@ namespace DiscordBotBase
1010
/// </summary>
1111
public static class Constants
1212
{
13-
/// <summary>
14-
/// A warning emoji image URL.
15-
/// </summary>
13+
/// <summary>A warning emoji image URL.</summary>
1614
public const string WARNING_ICON = "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/26a0.png";
1715

18-
/// <summary>
19-
/// Generic reusable "information" icon.
20-
/// </summary>
16+
/// <summary>Generic reusable "information" icon.</summary>
2117
public const string INFO_ICON = "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/2139.png";
2218

23-
/// <summary>
24-
/// Generic reusable "speech bubble" icon.
25-
/// </summary>
19+
/// <summary>Generic reusable "speech bubble" icon.</summary>
2620
public const string SPEECH_BUBBLE_ICON = "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f4ac.png";
2721

28-
/// <summary>
29-
/// Generic reusable "red flag" icon.
30-
/// </summary>
22+
/// <summary>Generic reusable "red flag" icon.</summary>
3123
public const string RED_FLAG_ICON = "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f6a9.png";
3224

33-
/// <summary>
34-
/// A checkmark "accept"/"yes" emoji, for reactions.
35-
/// </summary>
25+
/// <summary>A checkmark "accept"/"yes" emoji, for reactions.</summary>
3626
public const string ACCEPT_EMOJI = "☑️";
3727

38-
/// <summary>
39-
/// A Red-X "deny"/"no" emoji, for reactions.
40-
/// </summary>
28+
/// <summary>A Red-X "deny"/"no" emoji, for reactions.</summary>
4129
public const string DENY_EMOJI = "❌";
4230
}
4331
}

0 commit comments

Comments
 (0)