Skip to content

Commit 0014d42

Browse files
committed
Fix up rebase changes and correct naming for a couple fields
1 parent 0fd3415 commit 0014d42

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/DevChatter.Bot.Infra.Discord/DiscordChatClient.cs

+14-14
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public class DiscordChatClient : IChatClient
1919
private readonly DiscordSocketClient _discordClient;
2020
private TaskCompletionSource<bool> _connectionCompletionTask = new TaskCompletionSource<bool>();
2121
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;
2525
private bool _isReady;
2626

2727
public DiscordChatClient(DiscordClientSettings settings)
@@ -39,27 +39,27 @@ public DiscordChatClient(DiscordClientSettings settings)
3939

4040
private async Task DiscordClientGuildAvailable(SocketGuild guild)
4141
{
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;
4545
_isReady = true;
4646
}
4747

4848
private async Task DiscordClientGuildUnavailable(SocketGuild guild)
4949
{
50-
_Guild = null;
51-
_GuildChannelIds.Clear();
50+
_guild = null;
51+
_guildChannels.Clear();
5252
_isReady = false;
5353
}
5454

5555
private async Task DiscordClientChannelCreated(SocketChannel newChannel)
5656
{
57-
_GuildChannelIds.Add(newChannel.Id);
57+
_guildChannels.Add(newChannel.Id);
5858
}
5959

6060
private async Task DiscordClientChannelDestroyed(SocketChannel oldChannel)
6161
{
62-
_GuildChannelIds.Remove(oldChannel.Id);
62+
_guildChannels.Remove(oldChannel.Id);
6363
}
6464

6565
private async Task DiscordClientMessageReceived(SocketMessage arg)
@@ -73,7 +73,7 @@ private async Task DiscordClientMessageReceived(SocketMessage arg)
7373
int commandStartIndex = 0;
7474
if (message.HasCharPrefix(_settings.CommandPrefix, ref commandStartIndex))
7575
{
76-
if (_GuildChannelIds.Contains(message.Channel.Id))
76+
if (_guildChannels.Contains(message.Channel.Id))
7777
{
7878
if (arg.Author is IGuildUser guildUser)
7979
{
@@ -147,12 +147,12 @@ private async Task DiscordClientUserLeft(SocketGuildUser arg)
147147
RaiseOnUserLeft(arg);
148148
}
149149

150-
public List<ChatUser> GetAllChatters()
150+
public IList<ChatUser> GetAllChatters()
151151
{
152152
if(!_isReady)
153153
return new List<ChatUser>();
154154

155-
var chatUsers = _Guild.Users.Select(user => user.ToChatUser(_settings)).ToList();
155+
var chatUsers = _guild.Users.Select(user => user.ToChatUser(_settings)).ToList();
156156
return chatUsers;
157157
}
158158

@@ -163,7 +163,7 @@ public void SendMessage(string message)
163163
return;
164164
}
165165

166-
_TextChannel.SendMessageAsync($"`{message}`").Wait();
166+
_textChannel.SendMessageAsync($"`{message}`").Wait();
167167
}
168168

169169
private void RaiseOnCommandReceived(IGuildUser user, string commandWord, List<string> arguments)

0 commit comments

Comments
 (0)