tgstation-server 5.12.1
The /tg/station 13 server suite
Loading...
Searching...
No Matches
ChatBotApiBase.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4
6{
8 public abstract class ChatBotApiBase : ChatBotSettings
9 {
13 public ICollection<ChatChannel>? Channels { get; set; }
14
20 {
21 if (!Provider.HasValue)
22 return true;
23 return Provider.Value switch
24 {
25#pragma warning disable CS0618
26 ChatProvider.Discord => Channels?.Select(x => (x.DiscordChannelId.HasValue || ulong.TryParse(x.ChannelData, out _)) && x.IrcChannel == null).All(x => x) ?? true,
27 ChatProvider.Irc => Channels?.Select(x => !x.DiscordChannelId.HasValue && (x.IrcChannel != null || x.ChannelData != null)).All(x => x) ?? true,
28#pragma warning restore CS0618
29 _ => throw new InvalidOperationException("Invalid provider type!"),
30 };
31 }
32 }
33}
bool ValidateProviderChannelTypes()
Validates Channels are correct for the ChatBotSettings.Provider.
ICollection< ChatChannel >? Channels
Channels the Discord bot should listen/announce in.
ChatProvider? Provider
The ChatProvider used for the connection.