tgstation-server 6.12.0
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 ChatProvider.Discord => Channels?.All(x => UInt64.TryParse(x.ChannelData, out _)) ?? true,
26 ChatProvider.Irc => Channels?.All(x => x.ChannelData != null && x.ChannelData[0] == '#') ?? true,
27 _ => throw new InvalidOperationException("Invalid provider type!"),
28 };
29 }
30 }
31}
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.