tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
ChatBot.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.ComponentModel.DataAnnotations;
4using System.Linq;
5
7
9{
11 public sealed class ChatBot : Api.Models.Internal.ChatBotSettings, ILegacyApiTransformable<ChatBotResponse>
12 {
16 public const ushort DefaultChannelLimit = 100;
17
21 public long InstanceId { get; set; }
22
26 [Required]
27 public Instance? Instance { get; set; }
28
32 public ICollection<ChatChannel> Channels { get; set; }
33
37 public ChatBot()
38 : this(new List<ChatChannel>())
39 {
40 }
41
46 public ChatBot(ICollection<ChatChannel> channels)
47 {
48 Channels = channels ?? throw new ArgumentNullException(nameof(channels));
49 }
50
52 public ChatBotResponse ToApi() => new()
53 {
54 Channels = Channels.Select(x => x.ToApi(this.Require(x => x.Provider))).ToList(),
58 Id = Id,
59 Name = Name,
62 };
63 }
64}
virtual ? long Id
The ID of the entity.
Definition EntityId.cs:13
ushort? ChannelLimit
The maximum number of ChatChannels the ChatBotSettings may contain.
string? ConnectionString
The information used to connect to the Provider.
ChatProvider? Provider
The ChatProvider used for the connection.
uint? ReconnectionInterval
The time interval in minutes the chat bot attempts to reconnect if Enabled and disconnected....
virtual ? string Name
The name of the entity represented by the NamedEntity.
ICollection< ChatChannel > Channels
See Api.Models.Internal.ChatBotApiBase.Channels.
Definition ChatBot.cs:32
ChatBot()
Initializes a new instance of the ChatBot class.
Definition ChatBot.cs:37
long InstanceId
The instance Api.Models.EntityId.Id.
Definition ChatBot.cs:21
ChatBot(ICollection< ChatChannel > channels)
Initializes a new instance of the ChatBot class.
Definition ChatBot.cs:46
const ushort DefaultChannelLimit
Default for Api.Models.Internal.ChatBotSettings.ChannelLimit.
Definition ChatBot.cs:16
Represents an Api.Models.Instance in the database.
Definition Instance.cs:11
Represents a host-side model that may be transformed into a TApiModel .