diff --git a/_discord_connection_string_builder_8cs_source.html b/_discord_connection_string_builder_8cs_source.html
index 37489888ac..c43a478a11 100644
--- a/_discord_connection_string_builder_8cs_source.html
+++ b/_discord_connection_string_builder_8cs_source.html
@@ -84,34 +84,48 @@ $(function() {
-
+
-
+
-
-
- 37 if(connectionString ==
null)
- 38 throw new ArgumentNullException(nameof(connectionString));
-
- 40 var splits = connectionString.Split(
';');
-
-
-
-
-
-
- 48 public override string ToString() => $
"{BotToken};{(int)DMOutputDisplay}";
-
-
+
+
+
+
+
+
+
+ 45 if(connectionString ==
null)
+ 46 throw new ArgumentNullException(nameof(connectionString));
+
+ 48 var splits = connectionString.Split(
';');
+
+
+
+
+ 53 if (splits.Length > 1 && Int32.TryParse(splits[2], out Int32 basedMeme))
+
+
+
+
+
+
+
+
+
+ 64 public override string ToString() => $
"{BotToken};{(int)DMOutputDisplay};{Convert.ToInt32(BasedMeme)}";
+
+
-DiscordDMOutputDisplayType DMOutputDisplay
The DiscordDMOutputDisplayType.
+DiscordDMOutputDisplayType DMOutputDisplay
The DiscordDMOutputDisplayType.
string? BotToken
The Discord bot token.
DiscordDMOutputDisplayType
When the DM output section of Discord deployment embeds should be shown.
-DiscordConnectionStringBuilder(string connectionString)
Construct a DiscordConnectionStringBuilder from a connectionString
+DiscordConnectionStringBuilder(string connectionString)
Construct a DiscordConnectionStringBuilder from a connectionString
override string ToString()
Gets the ChatBot.ConnectionString associated with the ChatConnectionStringBuilder
-DiscordConnectionStringBuilder()
Construct a DiscordConnectionStringBuilder
+bool BasedMeme
bool to enable based mode. Will auto reply with a youtube link to a video that says "based on the har...
+DiscordConnectionStringBuilder()
Construct a DiscordConnectionStringBuilder
ChatConnectionStringBuilder for ChatProvider.Discord
Helper for building ChatBot.ConnectionStrings
diff --git a/_discord_provider_8cs_source.html b/_discord_provider_8cs_source.html
index 103f2e2fb8..77f3203ceb 100644
--- a/_discord_provider_8cs_source.html
+++ b/_discord_provider_8cs_source.html
@@ -109,455 +109,458 @@ $(function() {
-
+
- 65 static string NormalizeMentions(
string fromDiscord) => fromDiscord.Replace(
"<@!",
"<@", StringComparison.Ordinal);
-
-
-
-
- 77 ILogger<DiscordProvider> logger,
- 78 Models.ChatBot chatBot)
-
-
-
-
-
-
-
-
- 87 client =
new DiscordSocketClient();
-
-
-
-
-
-
- 95 await base.DisposeAsync().ConfigureAwait(
false);
-
-
-
-
-
- 106 if (e.Author.Id ==
client.CurrentUser.Id)
-
-
-
- 110 void StartTyping() => typingState = e.Channel.EnterTypingState();
-
-
- 113 if (e.Content.Equals(
"Based on what?", StringComparison.OrdinalIgnoreCase))
-
-
-
-
-
-
- 120 "https://youtu.be/LrNu-SuFF_o",
-
- 122 .ConfigureAwait(
false);
-
-
-
- 126 var pm = e.Channel is IPrivateChannel;
- 127 var shouldNotAnswer = !pm;
-
-
-
+
+
+ 70 static string NormalizeMentions(
string fromDiscord) => fromDiscord.Replace(
"<@!",
"<@", StringComparison.Ordinal);
+
+
+
+
+ 82 ILogger<DiscordProvider> logger,
+ 83 Models.ChatBot chatBot)
+
+
+
+
+
+
+
+
+
+ 93 client =
new DiscordSocketClient();
+
+
+
+
+
+
+ 101 await base.DisposeAsync().ConfigureAwait(
false);
+
+
+
+
+
+ 112 if (e.Author.Id ==
client.CurrentUser.Id)
+
+
+
+ 116 void StartTyping() => typingState = e.Channel.EnterTypingState();
+
+
+ 119 if (
basedMeme && e.Content.Equals(
"Based on what?", StringComparison.OrdinalIgnoreCase))
+
+
+
+
+
+
+ 126 "https://youtu.be/LrNu-SuFF_o",
+
+ 128 .ConfigureAwait(
false);
+
+
-
- 133 var mentionedUs = e.MentionedUsers.Any(x => x.Id ==
client.CurrentUser.Id)
- 134 || (!shouldNotAnswer && content.Split(
' ').First().Equals(
ChatManager.
CommonMention, StringComparison.OrdinalIgnoreCase));
-
-
+ 132 var pm = e.Channel is IPrivateChannel;
+ 133 var shouldNotAnswer = !pm;
+
+
+
-
-
-
-
- 142 Logger.LogTrace(
"Ignoring mention from {0} ({1}) by {2} ({3}). Channel not mapped!", e.Channel.Id, e.Channel.Name, e.Author.Id, e.Author.Username);
+
+ 139 var mentionedUs = e.MentionedUsers.Any(x => x.Id ==
client.CurrentUser.Id)
+ 140 || (!shouldNotAnswer && content.Split(
' ').First().Equals(
ChatManager.
CommonMention, StringComparison.OrdinalIgnoreCase));
+
+
-
- 145 await
SendMessage(e.Channel.Id,
"I do not respond to this channel!",
default).ConfigureAwait(
false);
-
-
-
-
-
-
-
-
-
-
- 156 RealId = e.Author.
Id,
-
-
- 159 RealId = e.Channel.
Id,
- 160 IsPrivateChannel = pm,
- 161 ConnectionName = pm ? e.Author.Username : (e.Channel as ITextChannel)?.Guild.Name ??
"UNKNOWN",
- 162 FriendlyName = e.Channel.Name
-
-
-
- 166 FriendlyName = e.Author.Username,
-
-
- 169 Context = typingState
-
-
-
-
-
-
-
- 177 typingState?.Dispose();
-
-
-
- 182 protected override async Task
Connect(CancellationToken cancellationToken)
-
-
-
- 186 await
client.LoginAsync(TokenType.Bot,
botToken,
true).ConfigureAwait(
false);
-
- 188 Logger.LogTrace(
"Logged in.");
- 189 cancellationToken.ThrowIfCancellationRequested();
-
- 191 await
client.StartAsync().ConfigureAwait(
false);
-
- 193 Logger.LogTrace(
"Started.");
-
- 195 var channelsAvailable =
new TaskCompletionSource<object>();
-
-
- 198 channelsAvailable.TrySetResult(
null);
- 199 return Task.CompletedTask;
-
-
- 202 client.Ready += ReadyCallback;
-
-
- 205 using (cancellationToken.Register(() => channelsAvailable.SetCanceled()))
- 206 await channelsAvailable.Task.ConfigureAwait(
false);
-
-
-
- 210 client.Ready -= ReadyCallback;
-
-
- 213 catch (OperationCanceledException)
-
-
-
-
-
-
-
-
-
- 224 protected override async Task
DisconnectImpl(CancellationToken cancellationToken)
-
-
-
- 228 cancellationToken.ThrowIfCancellationRequested();
- 229 await
client.StopAsync().ConfigureAwait(
false);
- 230 Logger.LogTrace(
"Stopped.");
- 231 await
client.LogoutAsync().ConfigureAwait(
false);
- 232 Logger.LogDebug(
"Disconnected!");
-
- 234 catch (OperationCanceledException)
-
-
-
-
-
- 240 Logger.LogWarning(e,
"Error disconnecting from discord!");
-
-
-
- 245 public override Task<IReadOnlyCollection<ChannelRepresentation>>
MapChannels(IEnumerable<Api.Models.ChatChannel> channels, CancellationToken cancellationToken)
-
- 247 if (channels ==
null)
- 248 throw new ArgumentNullException(nameof(channels));
+
+
+
+
+ 148 Logger.LogTrace(
"Ignoring mention from {0} ({1}) by {2} ({3}). Channel not mapped!", e.Channel.Id, e.Channel.Name, e.Author.Id, e.Author.Username);
+
+
+ 151 await
SendMessage(e.Channel.Id,
"I do not respond to this channel!",
default).ConfigureAwait(
false);
+
+
+
+
+
+
+
+
+
+
+ 162 RealId = e.Author.
Id,
+
+
+ 165 RealId = e.Channel.
Id,
+ 166 IsPrivateChannel = pm,
+ 167 ConnectionName = pm ? e.Author.Username : (e.Channel as ITextChannel)?.Guild.Name ??
"UNKNOWN",
+ 168 FriendlyName = e.Channel.Name
+
+
+
+ 172 FriendlyName = e.Author.Username,
+
+
+ 175 Context = typingState
+
+
+
+
+
+
+
+ 183 typingState?.Dispose();
+
+
+
+ 188 protected override async Task
Connect(CancellationToken cancellationToken)
+
+
+
+ 192 await
client.LoginAsync(TokenType.Bot,
botToken,
true).ConfigureAwait(
false);
+
+ 194 Logger.LogTrace(
"Logged in.");
+ 195 cancellationToken.ThrowIfCancellationRequested();
+
+ 197 await
client.StartAsync().ConfigureAwait(
false);
+
+ 199 Logger.LogTrace(
"Started.");
+
+ 201 var channelsAvailable =
new TaskCompletionSource<object>();
+
+
+ 204 channelsAvailable.TrySetResult(
null);
+ 205 return Task.CompletedTask;
+
+
+ 208 client.Ready += ReadyCallback;
+
+
+ 211 using (cancellationToken.Register(() => channelsAvailable.SetCanceled()))
+ 212 await channelsAvailable.Task.ConfigureAwait(
false);
+
+
+
+ 216 client.Ready -= ReadyCallback;
+
+
+ 219 catch (OperationCanceledException)
+
+
+
+
+
+
+
+
+
+ 230 protected override async Task
DisconnectImpl(CancellationToken cancellationToken)
+
+
+
+ 234 cancellationToken.ThrowIfCancellationRequested();
+ 235 await
client.StopAsync().ConfigureAwait(
false);
+ 236 Logger.LogTrace(
"Stopped.");
+ 237 await
client.LogoutAsync().ConfigureAwait(
false);
+ 238 Logger.LogDebug(
"Disconnected!");
+
+ 240 catch (OperationCanceledException)
+
+
+
+
+
+ 246 Logger.LogWarning(e,
"Error disconnecting from discord!");
+
+
-
-
- 252 Logger.LogWarning(
"Cannot map channels, provider disconnected!");
- 253 return Task.FromResult<IReadOnlyCollection<ChannelRepresentation>>(Array.Empty<
ChannelRepresentation>());
-
+ 251 public override Task<IReadOnlyCollection<ChannelRepresentation>>
MapChannels(IEnumerable<Api.Models.ChatChannel> channels, CancellationToken cancellationToken)
+
+ 253 if (channels ==
null)
+ 254 throw new ArgumentNullException(nameof(channels));
-
+
- 258 if (!channelFromDB.DiscordChannelId.HasValue)
- 259 throw new InvalidOperationException(
"ChatChannel missing DiscordChannelId!");
-
- 261 var channelId = channelFromDB.DiscordChannelId.Value;
- 262 ulong discordChannelId;
- 263 string connectionName;
-
-
-
- 267 connectionName =
client.CurrentUser.Username;
- 268 friendlyName =
"(Unmapped accessible channels)";
- 269 discordChannelId = 0;
-
-
+ 258 Logger.LogWarning(
"Cannot map channels, provider disconnected!");
+ 259 return Task.FromResult<IReadOnlyCollection<ChannelRepresentation>>(Array.Empty<
ChannelRepresentation>());
+
+
+
+
+ 264 if (!channelFromDB.DiscordChannelId.HasValue)
+ 265 throw new InvalidOperationException(
"ChatChannel missing DiscordChannelId!");
+
+ 267 var channelId = channelFromDB.DiscordChannelId.Value;
+ 268 ulong discordChannelId;
+ 269 string connectionName;
+
+
- 273 var discordChannel =
client.GetChannel(channelId);
- 274 if (!(discordChannel is ITextChannel textChannel))
-
- 276 Logger.LogWarning(
"Cound not map channel {0}! Incorrect type: {1}", channelId, discordChannel?.GetType());
-
-
-
- 280 discordChannelId = textChannel.Id;
- 281 connectionName = textChannel.Guild.Name;
- 282 friendlyName = textChannel.Name;
-
-
-
-
- 287 RealId = discordChannelId,
-
- 289 ConnectionName = connectionName,
- 290 FriendlyName = friendlyName,
- 291 IsPrivateChannel =
false,
- 292 Tag = channelFromDB.Tag
-
- 294 Logger.LogTrace(
"Mapped channel {0}: {1}", channelModel.RealId, channelModel.FriendlyName);
-
-
-
- 298 var enumerator = channels
- 299 .Select(x => GetModelChannelFromDBChannel(x))
- 300 .Where(x => x !=
null).ToList();
-
-
-
-
-
-
+ 273 connectionName =
client.CurrentUser.Username;
+ 274 friendlyName =
"(Unmapped accessible channels)";
+ 275 discordChannelId = 0;
+
+
+
+ 279 var discordChannel =
client.GetChannel(channelId);
+ 280 if (!(discordChannel is ITextChannel textChannel))
+
+ 282 Logger.LogWarning(
"Cound not map channel {0}! Incorrect type: {1}", channelId, discordChannel?.GetType());
+
+
+
+ 286 discordChannelId = textChannel.Id;
+ 287 connectionName = textChannel.Guild.Name;
+ 288 friendlyName = textChannel.Name;
+
+
+
+
+ 293 RealId = discordChannelId,
+
+ 295 ConnectionName = connectionName,
+ 296 FriendlyName = friendlyName,
+ 297 IsPrivateChannel =
false,
+ 298 Tag = channelFromDB.Tag
+
+ 300 Logger.LogTrace(
"Mapped channel {0}: {1}", channelModel.RealId, channelModel.FriendlyName);
+
+
+
+ 304 var enumerator = channels
+ 305 .Select(x => GetModelChannelFromDBChannel(x))
+ 306 .Where(x => x !=
null).ToList();
- 308 return Task.FromResult<IReadOnlyCollection<ChannelRepresentation>>(enumerator);
-
-
- 312 public override async Task
SendMessage(ulong channelId,
string message, CancellationToken cancellationToken)
-
- 314 var requestOptions =
new RequestOptions
-
- 316 CancelToken = cancellationToken,
-
-
-
- 320 Task SendToChannel(IMessageChannel channel) => channel.SendMessageAsync(
-
-
-
-
+
+
+
+
+
+
+ 314 return Task.FromResult<IReadOnlyCollection<ChannelRepresentation>>(enumerator);
+
+
+ 318 public override async Task
SendMessage(ulong channelId,
string message, CancellationToken cancellationToken)
+
+ 320 var requestOptions =
new RequestOptions
+
+ 322 CancelToken = cancellationToken,
+
+
-
-
-
-
- 330 var unmappedTextChannels =
client
-
- 332 .SelectMany(x => x.TextChannels);
-
-
- 335 unmappedTextChannels = unmappedTextChannels.Where(x => !
mappedChannels.Contains(x.Id));
-
-
- 338 var channelCount = 0UL;
- 339 var tasks = unmappedTextChannels
-
-
-
- 343 return SendToChannel(x);
-
-
- 346 if (channelCount > 0)
-
- 348 Logger.LogTrace(
"Dispatched to {0} unmapped channels...", channelCount);
- 349 await Task.WhenAll(tasks).ConfigureAwait(
false);
-
+ 326 Task SendToChannel(IMessageChannel channel) => channel.SendMessageAsync(
+
+
+
+
+
+
+
+
+
+ 336 var unmappedTextChannels =
client
+
+ 338 .SelectMany(x => x.TextChannels);
+
+
+ 341 unmappedTextChannels = unmappedTextChannels.Where(x => !
mappedChannels.Contains(x.Id));
+
+
+ 344 var channelCount = 0UL;
+ 345 var tasks = unmappedTextChannels
+
+
+
+ 349 return SendToChannel(x);
+
-
-
-
- 355 if (!(
client.GetChannel(channelId) is IMessageChannel channel))
-
+ 352 if (channelCount > 0)
+
+ 354 Logger.LogTrace(
"Dispatched to {0} unmapped channels...", channelCount);
+ 355 await Task.WhenAll(tasks).ConfigureAwait(
false);
+
- 358 await SendToChannel(channel).ConfigureAwait(
false);
-
-
-
- 362 if (e is OperationCanceledException)
- 363 cancellationToken.ThrowIfCancellationRequested();
- 364 Logger.LogWarning(e,
"Error sending discord message!");
+
+
+
+ 361 if (!(
client.GetChannel(channelId) is IMessageChannel channel))
+
+
+ 364 await SendToChannel(channel).ConfigureAwait(
false);
-
-
-
- 370 Models.RevisionInformation revisionInformation,
- 371 Version byondVersion,
- 372 DateTimeOffset? estimatedCompletionTime,
-
-
-
- 376 bool localCommitPushed,
- 377 CancellationToken cancellationToken)
-
- 379 bool gitHub = gitHubOwner !=
null && gitHubRepo !=
null;
-
- 381 localCommitPushed |= revisionInformation.CommitSha == revisionInformation.OriginCommitSha;
-
- 383 var fields =
new List<EmbedFieldBuilder>
-
- 385 new EmbedFieldBuilder
-
- 387 Name =
"BYOND Version",
- 388 Value = $
"{byondVersion.Major}.{byondVersion.Minor}{(byondVersion.Build > 0 ? $".{byondVersion.Build}
" : String.Empty)}",
-
-
+
+
+ 368 if (e is OperationCanceledException)
+ 369 cancellationToken.ThrowIfCancellationRequested();
+ 370 Logger.LogWarning(e,
"Error sending discord message!");
+
+
+
+
+ 376 Models.RevisionInformation revisionInformation,
+ 377 Version byondVersion,
+ 378 DateTimeOffset? estimatedCompletionTime,
+
+
+
+ 382 bool localCommitPushed,
+ 383 CancellationToken cancellationToken)
+
+ 385 bool gitHub = gitHubOwner !=
null && gitHubRepo !=
null;
+
+ 387 localCommitPushed |= revisionInformation.CommitSha == revisionInformation.OriginCommitSha;
+
+ 389 var fields =
new List<EmbedFieldBuilder>
+
391 new EmbedFieldBuilder
- 393 Name =
"Local Commit",
- 394 Value = localCommitPushed && gitHub
- 395 ? $
"[{revisionInformation.CommitSha.Substring(0, 7)}](https://github.com/{gitHubOwner}/{gitHubRepo}/commit/{revisionInformation.CommitSha})"
- 396 : revisionInformation.CommitSha.Substring(0, 7),
-
-
- 399 new EmbedFieldBuilder
-
- 401 Name =
"Branch Commit",
-
- 403 ? $
"[{revisionInformation.OriginCommitSha.Substring(0, 7)}](https://github.com/{gitHubOwner}/{gitHubRepo}/commit/{revisionInformation.OriginCommitSha})"
- 404 : revisionInformation.OriginCommitSha.Substring(0, 7),
-
-
-
-
- 409 fields.AddRange((revisionInformation.ActiveTestMerges ?? Enumerable.Empty<
RevInfoTestMerge>())
- 410 .Select(x => x.TestMerge)
- 411 .Select(x =>
new EmbedFieldBuilder
-
- 413 Name = $
"#{x.Number}",
- 414 Value = $
"[{x.TitleAtMerge}]({x.Url}) by _[@{x.Author}](https://github.com/{x.Author})_{Environment.NewLine}Commit: [{x.PullRequestRevision.Substring(0, 7)}](https://github.com/{gitHubOwner}/{gitHubRepo}/commit/{x.PullRequestRevision}){(String.IsNullOrWhiteSpace(x.Comment) ? String.Empty : $"{Environment.NewLine}_**{x.Comment}**_
")}"
-
-
- 417 var builder =
new EmbedBuilder
-
- 419 Author =
new EmbedAuthorBuilder
-
- 421 Name = assemblyInformationProvider.VersionPrefix,
- 422 Url =
"https://github.com/tgstation/tgstation-server",
- 423 IconUrl =
"https://avatars0.githubusercontent.com/u/1363778?s=280&v=4"
-
-
- 426 Description =
"TGS has begun deploying active repository code to production.",
-
- 428 Title =
"Code Deployment",
- 429 Footer =
new EmbedFooterBuilder
-
- 431 Text = $
"In progress...{(estimatedCompletionTime.HasValue ? " ETA
" : String.Empty)}"
-
- 433 Timestamp = estimatedCompletionTime
-
-
- 436 Logger.LogTrace(
"Attempting to post deploy embed to channel {0}...", channelId);
- 437 if (!(client.GetChannel(channelId) is IMessageChannel channel))
-
- 439 Logger.LogTrace(
"Channel ID {0} does not exist or is not an IMessageChannel!", channelId);
- 440 return (errorMessage, dreamMakerOutput) => Task.CompletedTask;
-
-
- 443 var message = await channel.SendMessageAsync(
- 444 "DM: Deployment in Progress...",
-
-
-
-
- 449 CancelToken = cancellationToken
-
- 451 .ConfigureAwait(
false);
-
- 453 return async (errorMessage, dreamMakerOutput) =>
-
- 455 var completionString = errorMessage ==
null ?
"Succeeded" :
"Failed";
- 456 builder.Footer.Text = completionString;
- 457 builder.Color = errorMessage ==
null ? Color.Green : Color.Red;
- 458 builder.Timestamp = DateTimeOffset.Now;
- 459 builder.Description = errorMessage ==
null
- 460 ?
"The deployment completed successfully and will be available at the next server reboot."
- 461 :
"The deployment failed.";
-
- 463 var showDMOutput = outputDisplayType
switch
-
-
-
-
- 468 _ =>
throw new InvalidOperationException($
"Invalid DiscordDMOutputDisplayType: {outputDisplayType}"),
-
-
- 471 if (showDMOutput && dreamMakerOutput !=
null)
- 472 builder.AddField(
new EmbedFieldBuilder
-
- 474 Name =
"DreamMaker Output",
- 475 Value = $
"```{Environment.NewLine}{dreamMakerOutput}{Environment.NewLine}```"
-
-
- 478 if (errorMessage !=
null)
- 479 builder.AddField(
new EmbedFieldBuilder
-
- 481 Name =
"Error Message",
-
-
-
- 485 var updatedMessage = $
"DM: Deployment {completionString}!";
-
-
- 488 await message.ModifyAsync(
-
-
- 491 props.Content = updatedMessage;
- 492 props.Embed = builder.Build();
-
- 494 .ConfigureAwait(
false);
-
-
-
- 498 Logger.LogWarning(ex,
"Updating deploy embed {0} failed, attempting new post!", message.Id);
-
-
- 501 await channel.SendMessageAsync(
-
-
-
- 505 .ConfigureAwait(
false);
-
- 507 catch (Exception ex2)
-
- 509 Logger.LogWarning(ex2,
"Posting completion deploy embed failed!");
-
-
-
-
-
-
+ 393 Name =
"BYOND Version",
+ 394 Value = $
"{byondVersion.Major}.{byondVersion.Minor}{(byondVersion.Build > 0 ? $".{byondVersion.Build}
" : String.Empty)}",
+
+
+ 397 new EmbedFieldBuilder
+
+ 399 Name =
"Local Commit",
+ 400 Value = localCommitPushed && gitHub
+ 401 ? $
"[{revisionInformation.CommitSha.Substring(0, 7)}](https://github.com/{gitHubOwner}/{gitHubRepo}/commit/{revisionInformation.CommitSha})"
+ 402 : revisionInformation.CommitSha.Substring(0, 7),
+
+
+ 405 new EmbedFieldBuilder
+
+ 407 Name =
"Branch Commit",
+
+ 409 ? $
"[{revisionInformation.OriginCommitSha.Substring(0, 7)}](https://github.com/{gitHubOwner}/{gitHubRepo}/commit/{revisionInformation.OriginCommitSha})"
+ 410 : revisionInformation.OriginCommitSha.Substring(0, 7),
+
+
+
+
+ 415 fields.AddRange((revisionInformation.ActiveTestMerges ?? Enumerable.Empty<
RevInfoTestMerge>())
+ 416 .Select(x => x.TestMerge)
+ 417 .Select(x =>
new EmbedFieldBuilder
+
+ 419 Name = $
"#{x.Number}",
+ 420 Value = $
"[{x.TitleAtMerge}]({x.Url}) by _[@{x.Author}](https://github.com/{x.Author})_{Environment.NewLine}Commit: [{x.PullRequestRevision.Substring(0, 7)}](https://github.com/{gitHubOwner}/{gitHubRepo}/commit/{x.PullRequestRevision}){(String.IsNullOrWhiteSpace(x.Comment) ? String.Empty : $"{Environment.NewLine}_**{x.Comment}**_
")}"
+
+
+ 423 var builder =
new EmbedBuilder
+
+ 425 Author =
new EmbedAuthorBuilder
+
+ 427 Name = assemblyInformationProvider.VersionPrefix,
+ 428 Url =
"https://github.com/tgstation/tgstation-server",
+ 429 IconUrl =
"https://avatars0.githubusercontent.com/u/1363778?s=280&v=4"
+
+
+ 432 Description =
"TGS has begun deploying active repository code to production.",
+
+ 434 Title =
"Code Deployment",
+ 435 Footer =
new EmbedFooterBuilder
+
+ 437 Text = $
"In progress...{(estimatedCompletionTime.HasValue ? " ETA
" : String.Empty)}"
+
+ 439 Timestamp = estimatedCompletionTime
+
+
+ 442 Logger.LogTrace(
"Attempting to post deploy embed to channel {0}...", channelId);
+ 443 if (!(client.GetChannel(channelId) is IMessageChannel channel))
+
+ 445 Logger.LogTrace(
"Channel ID {0} does not exist or is not an IMessageChannel!", channelId);
+ 446 return (errorMessage, dreamMakerOutput) => Task.CompletedTask;
+
+
+ 449 var message = await channel.SendMessageAsync(
+ 450 "DM: Deployment in Progress...",
+
+
+
+
+ 455 CancelToken = cancellationToken
+
+ 457 .ConfigureAwait(
false);
+
+ 459 return async (errorMessage, dreamMakerOutput) =>
+
+ 461 var completionString = errorMessage ==
null ?
"Succeeded" :
"Failed";
+ 462 builder.Footer.Text = completionString;
+ 463 builder.Color = errorMessage ==
null ? Color.Green : Color.Red;
+ 464 builder.Timestamp = DateTimeOffset.Now;
+ 465 builder.Description = errorMessage ==
null
+ 466 ?
"The deployment completed successfully and will be available at the next server reboot."
+ 467 :
"The deployment failed.";
+
+ 469 var showDMOutput = outputDisplayType
switch
+
+
+
+
+ 474 _ =>
throw new InvalidOperationException($
"Invalid DiscordDMOutputDisplayType: {outputDisplayType}"),
+
+
+ 477 if (showDMOutput && dreamMakerOutput !=
null)
+ 478 builder.AddField(
new EmbedFieldBuilder
+
+ 480 Name =
"DreamMaker Output",
+ 481 Value = $
"```{Environment.NewLine}{dreamMakerOutput}{Environment.NewLine}```"
+
+
+ 484 if (errorMessage !=
null)
+ 485 builder.AddField(
new EmbedFieldBuilder
+
+ 487 Name =
"Error Message",
+
+
+
+ 491 var updatedMessage = $
"DM: Deployment {completionString}!";
+
+
+ 494 await message.ModifyAsync(
+
+
+ 497 props.Content = updatedMessage;
+ 498 props.Embed = builder.Build();
+
+ 500 .ConfigureAwait(
false);
+
+
+
+ 504 Logger.LogWarning(ex,
"Updating deploy embed {0} failed, attempting new post!", message.Id);
+
+
+ 507 await channel.SendMessageAsync(
+
+
+
+ 511 .ConfigureAwait(
false);
+
+ 513 catch (Exception ex2)
+
+ 515 Logger.LogWarning(ex2,
"Posting completion deploy embed failed!");
+
+
+
+
+
+
-override async Task SendMessage(ulong channelId, string message, CancellationToken cancellationToken)
Send a message to the IProvider
+override async Task SendMessage(ulong channelId, string message, CancellationToken cancellationToken)
Send a message to the IProvider
readonly IJobManager jobManager
The IJobManager for the Provider.
Represents a Providers.IProvider channel.
ErrorCode
Types of ErrorMessages that the API may return.
-async Task Client_MessageReceived(SocketMessage e)
Handle a message recieved from Discord
+async Task Client_MessageReceived(SocketMessage e)
Handle a message recieved from Discord
Many to many relationship for Models.RevisionInformation and Models.TestMerge
bool IsAdminChannel
If this is considered a channel for admin commands
-override Task< IReadOnlyCollection< ChannelRepresentation > > MapChannels(IEnumerable< Api.Models.ChatChannel > channels, CancellationToken cancellationToken)
+override Task< IReadOnlyCollection< ChannelRepresentation > > MapChannels(IEnumerable< Api.Models.ChatChannel > channels, CancellationToken cancellationToken)
Operation exceptions thrown from the context of a Models.Job
-override async Task DisconnectImpl(CancellationToken cancellationToken)
Gracefully disconnects the provider.
+override async Task DisconnectImpl(CancellationToken cancellationToken)
Gracefully disconnects the provider.
ILogger< Provider > Logger
The ILogger for the Provider.
@@ -565,28 +568,29 @@ $(function() {
const string CommonMention
The common bot mention.
DiscordDMOutputDisplayType
When the DM output section of Discord deployment embeds should be shown.
-override async ValueTask DisposeAsync()
+override async ValueTask DisposeAsync()
IProvider for the Discord app
-DiscordProvider(IJobManager jobManager, IAssemblyInformationProvider assemblyInformationProvider, ILogger< DiscordProvider > logger, Models.ChatBot chatBot)
Construct a DiscordProvider
+DiscordProvider(IJobManager jobManager, IAssemblyInformationProvider assemblyInformationProvider, ILogger< DiscordProvider > logger, Models.ChatBot chatBot)
Construct a DiscordProvider
Represents a message recieved by a IProvider
-override async Task Connect(CancellationToken cancellationToken)
Attempt to connect the Provider.
+override async Task Connect(CancellationToken cancellationToken)
Attempt to connect the Provider.
void EnqueueMessage(Message message)
Queues a message for NextMessage(CancellationToken)
readonly IAssemblyInformationProvider assemblyInformationProvider
The IAssemblyInformationProvider for the DiscordProvider.
string Id
Backing field for RealId. Represented as a string to avoid BYOND percision loss
-readonly DiscordDMOutputDisplayType outputDisplayType
The DiscordDMOutputDisplayType.
+readonly DiscordDMOutputDisplayType outputDisplayType
The DiscordDMOutputDisplayType.
readonly string botToken
The Discord bot token.
readonly DiscordSocketClient client
The DiscordSocketClient for the DiscordProvider
ChatConnectionStringBuilder for ChatProvider.Discord
Represents a tgs_chat_user datum
+readonly bool basedMeme
bool to enable based mode. Will auto reply with a youtube link to a video that says "based on the har...
override string BotMention
readonly List< ulong > mappedChannels
List<T> of mapped ITextChannel IEntity<TId>.Ids
-override async Task< Func< string, string, Task > > SendUpdateMessage(Models.RevisionInformation revisionInformation, Version byondVersion, DateTimeOffset? estimatedCompletionTime, string gitHubOwner, string gitHubRepo, ulong channelId, bool localCommitPushed, CancellationToken cancellationToken)
+override async Task< Func< string, string, Task > > SendUpdateMessage(Models.RevisionInformation revisionInformation, Version byondVersion, DateTimeOffset? estimatedCompletionTime, string gitHubOwner, string gitHubRepo, ulong channelId, bool localCommitPushed, CancellationToken cancellationToken)
string Id
Backing field for RealId. Represented as a string to avoid BYOND percision loss
Manages the runtime of Jobs
diff --git a/class_controller.html b/class_controller.html
index 1bbc42984f..8ad2b6f747 100644
--- a/class_controller.html
+++ b/class_controller.html
@@ -92,7 +92,7 @@ Inheritance diagram for Controller:
[legend]
The documentation for this class was generated from the following file:
diff --git a/class_i_async_disposable.html b/class_i_async_disposable.html
index 6e70ca1096..659676196f 100644
--- a/class_i_async_disposable.html
+++ b/class_i_async_disposable.html
@@ -93,7 +93,7 @@ Inheritance diagram for IAsyncDisposable:
[legend]
The documentation for this class was generated from the following file:
diff --git a/class_i_design_time_db_context_factory.html b/class_i_design_time_db_context_factory.html
index 9c8c1a117c..9a34b5ec20 100644
--- a/class_i_design_time_db_context_factory.html
+++ b/class_i_design_time_db_context_factory.html
@@ -81,7 +81,7 @@ Inheritance diagram for IDesignTimeDbContextFactory:
[legend]
The documentation for this class was generated from the following file:
diff --git a/class_i_disposable.html b/class_i_disposable.html
index cfa9c83676..7c7279fdc8 100644
--- a/class_i_disposable.html
+++ b/class_i_disposable.html
@@ -124,7 +124,7 @@ Inheritance diagram for IDisposable:
[legend]
The documentation for this class was generated from the following file:
diff --git a/class_i_hosted_service.html b/class_i_hosted_service.html
index 20ecbbbb71..f6a4a1ce4c 100644
--- a/class_i_hosted_service.html
+++ b/class_i_hosted_service.html
@@ -99,7 +99,7 @@ Inheritance diagram for IHostedService:
[legend]
The documentation for this class was generated from the following file:
diff --git a/class_migration.html b/class_migration.html
index a43515ba83..75068e2fa4 100644
--- a/class_migration.html
+++ b/class_migration.html
@@ -71,7 +71,7 @@ $(function() {
Inherited by Tgstation.Server.Host.Database.Migrations.MSAddChatBotReconnectionInterval, Tgstation.Server.Host.Database.Migrations.MSAddCompileJobDMApiVersion, Tgstation.Server.Host.Database.Migrations.MSAddDeploymentColumns, Tgstation.Server.Host.Database.Migrations.MSAddHeartbeat, Tgstation.Server.Host.Database.Migrations.MSAddJobErrorCodes, Tgstation.Server.Host.Database.Migrations.MSAddMinimumSecurity, Tgstation.Server.Host.Database.Migrations.MSAllowNullDMApi, Tgstation.Server.Host.Database.Migrations.MSCheckpointRebuild, Tgstation.Server.Host.Database.Migrations.MSFixCascadingDelete, Tgstation.Server.Host.Database.Migrations.MSFixRevInfoIndex, Tgstation.Server.Host.Database.Migrations.MSInitialCreate, Tgstation.Server.Host.Database.Migrations.MSKillJsonsAddDMApiVersion, Tgstation.Server.Host.Database.Migrations.MSLimitsOnChat, Tgstation.Server.Host.Database.Migrations.MSNullableAndForeignKeyCleanup, Tgstation.Server.Host.Database.Migrations.MSReattachCompileJobRequired, Tgstation.Server.Host.Database.Migrations.MSRemoveExperimentalWatchdog, Tgstation.Server.Host.Database.Migrations.MSRemoveSoftColumns, Tgstation.Server.Host.Database.Migrations.MSToggleTestmergeComments, Tgstation.Server.Host.Database.Migrations.MSTonsOfValidation, Tgstation.Server.Host.Database.Migrations.MSTopicTimeout, Tgstation.Server.Host.Database.Migrations.MYAddChatBotReconnectionInterval, Tgstation.Server.Host.Database.Migrations.MYAddCompileJobDMApiVersion, Tgstation.Server.Host.Database.Migrations.MYAddDeploymentColumns, Tgstation.Server.Host.Database.Migrations.MYAddHeartbeat, Tgstation.Server.Host.Database.Migrations.MYAddJobErrorCodes, Tgstation.Server.Host.Database.Migrations.MYAddMinimumSecurity, Tgstation.Server.Host.Database.Migrations.MYAllowNullDMApi, Tgstation.Server.Host.Database.Migrations.MYCheckpointRebuild, Tgstation.Server.Host.Database.Migrations.MYFixCascadingDelete, Tgstation.Server.Host.Database.Migrations.MYFixForeignKey, Tgstation.Server.Host.Database.Migrations.MYFixRevInfoIndex, Tgstation.Server.Host.Database.Migrations.MYInitialCreate, Tgstation.Server.Host.Database.Migrations.MYKillJsonsAddDMApiVersion, Tgstation.Server.Host.Database.Migrations.MYLimitsOnChat, Tgstation.Server.Host.Database.Migrations.MYNullableAndForeignKeyCleanup, Tgstation.Server.Host.Database.Migrations.MYReattachCompileJobRequired, Tgstation.Server.Host.Database.Migrations.MYRemoveExperimentalWatchdog, Tgstation.Server.Host.Database.Migrations.MYRemoveSoftColumns, Tgstation.Server.Host.Database.Migrations.MYToggleTestmergeComments, Tgstation.Server.Host.Database.Migrations.MYTonsOfValidation, Tgstation.Server.Host.Database.Migrations.MYTopicTimeout, Tgstation.Server.Host.Database.Migrations.PGAddDeploymentColumns, Tgstation.Server.Host.Database.Migrations.PGAllowNullDMApi, Tgstation.Server.Host.Database.Migrations.PGCreate, Tgstation.Server.Host.Database.Migrations.PGRemoveExperimentalWatchdog, Tgstation.Server.Host.Database.Migrations.PGTopicTimeout, Tgstation.Server.Host.Database.Migrations.SLAddDeploymentColumns, Tgstation.Server.Host.Database.Migrations.SLAddHeartbeat, Tgstation.Server.Host.Database.Migrations.SLAllowNullDMApi, Tgstation.Server.Host.Database.Migrations.SLRebuild, Tgstation.Server.Host.Database.Migrations.SLRemoveExperimentalWatchdog, Tgstation.Server.Host.Database.Migrations.SLRemoveSoftColumns, and Tgstation.Server.Host.Database.Migrations.SLTopicTimeout.
The documentation for this class was generated from the following file:
diff --git a/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_discord_connection_string_builder-members.html b/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_discord_connection_string_builder-members.html
index b83f929f2e..061fc9c8ca 100644
--- a/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_discord_connection_string_builder-members.html
+++ b/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_discord_connection_string_builder-members.html
@@ -75,12 +75,13 @@ $(function() {
This is the complete list of members for Tgstation.Server.Api.Models.DiscordConnectionStringBuilder, including all inherited members.
src/Tgstation.Server.Api/Models/DiscordConnectionStringBuilder.cs
-DiscordDMOutputDisplayType DMOutputDisplay
The DiscordDMOutputDisplayType.
+DiscordDMOutputDisplayType DMOutputDisplay
The DiscordDMOutputDisplayType.
string? BotToken
The Discord bot token.
DiscordDMOutputDisplayType
When the DM output section of Discord deployment embeds should be shown.
+bool BasedMeme
bool to enable based mode. Will auto reply with a youtube link to a video that says "based on the har...