@@ -19,9 +19,9 @@ public class DiscordChatClient : IChatClient
19
19
private readonly DiscordSocketClient _discordClient ;
20
20
private TaskCompletionSource < bool > _connectionCompletionTask = new TaskCompletionSource < bool > ( ) ;
21
21
private TaskCompletionSource < bool > _disconnectionCompletionTask = new TaskCompletionSource < bool > ( ) ;
22
- private SocketGuild _Guild ;
23
- private readonly List < ulong > _GuildChannelIds = new List < ulong > ( ) ;
24
- private ISocketMessageChannel _TextChannel ;
22
+ private SocketGuild _guild ;
23
+ private readonly List < ulong > _guildChannels = new List < ulong > ( ) ;
24
+ private ISocketMessageChannel _textChannel ;
25
25
private bool _isReady ;
26
26
27
27
public DiscordChatClient ( DiscordClientSettings settings )
@@ -39,27 +39,27 @@ public DiscordChatClient(DiscordClientSettings settings)
39
39
40
40
private async Task DiscordClientGuildAvailable ( SocketGuild guild )
41
41
{
42
- _Guild = guild ;
43
- _GuildChannelIds . AddRange ( _Guild . Channels . Select ( channel => channel . Id ) ) ;
44
- _TextChannel = _Guild . Channels . FirstOrDefault ( channel => channel . Id == _settings . DiscordTextChannelId ) as ISocketMessageChannel ;
42
+ _guild = guild ;
43
+ _guildChannels . AddRange ( _guild . Channels . Select ( channel => channel . Id ) ) ;
44
+ _textChannel = _guild . Channels . FirstOrDefault ( channel => channel . Id == _settings . DiscordTextChannelId ) as ISocketMessageChannel ;
45
45
_isReady = true ;
46
46
}
47
47
48
48
private async Task DiscordClientGuildUnavailable ( SocketGuild guild )
49
49
{
50
- _Guild = null ;
51
- _GuildChannelIds . Clear ( ) ;
50
+ _guild = null ;
51
+ _guildChannels . Clear ( ) ;
52
52
_isReady = false ;
53
53
}
54
54
55
55
private async Task DiscordClientChannelCreated ( SocketChannel newChannel )
56
56
{
57
- _GuildChannelIds . Add ( newChannel . Id ) ;
57
+ _guildChannels . Add ( newChannel . Id ) ;
58
58
}
59
59
60
60
private async Task DiscordClientChannelDestroyed ( SocketChannel oldChannel )
61
61
{
62
- _GuildChannelIds . Remove ( oldChannel . Id ) ;
62
+ _guildChannels . Remove ( oldChannel . Id ) ;
63
63
}
64
64
65
65
private async Task DiscordClientMessageReceived ( SocketMessage arg )
@@ -73,7 +73,7 @@ private async Task DiscordClientMessageReceived(SocketMessage arg)
73
73
int commandStartIndex = 0 ;
74
74
if ( message . HasCharPrefix ( _settings . CommandPrefix , ref commandStartIndex ) )
75
75
{
76
- if ( _GuildChannelIds . Contains ( message . Channel . Id ) )
76
+ if ( _guildChannels . Contains ( message . Channel . Id ) )
77
77
{
78
78
if ( arg . Author is IGuildUser guildUser )
79
79
{
@@ -147,12 +147,12 @@ private async Task DiscordClientUserLeft(SocketGuildUser arg)
147
147
RaiseOnUserLeft ( arg ) ;
148
148
}
149
149
150
- public List < ChatUser > GetAllChatters ( )
150
+ public IList < ChatUser > GetAllChatters ( )
151
151
{
152
152
if ( ! _isReady )
153
153
return new List < ChatUser > ( ) ;
154
154
155
- var chatUsers = _Guild . Users . Select ( user => user . ToChatUser ( _settings ) ) . ToList ( ) ;
155
+ var chatUsers = _guild . Users . Select ( user => user . ToChatUser ( _settings ) ) . ToList ( ) ;
156
156
return chatUsers ;
157
157
}
158
158
@@ -163,7 +163,7 @@ public void SendMessage(string message)
163
163
return ;
164
164
}
165
165
166
- _TextChannel . SendMessageAsync ( $ "`{ message } `") . Wait ( ) ;
166
+ _textChannel . SendMessageAsync ( $ "`{ message } `") . Wait ( ) ;
167
167
}
168
168
169
169
private void RaiseOnCommandReceived ( IGuildUser user , string commandWord , List < string > arguments )
0 commit comments