File tree 1 file changed +15
-3
lines changed
src/DevChatter.Bot.Infra.Discord
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -31,25 +31,37 @@ public DiscordChatClient(DiscordClientSettings settings)
31
31
_discordClient . MessageReceived += DiscordClientMessageReceived ;
32
32
_discordClient . GuildAvailable += DiscordClientGuildAvailable ;
33
33
_discordClient . GuildUnavailable += DiscordClientGuildUnavailable ;
34
+ _discordClient . ChannelCreated += DiscordClientChannelCreated ;
35
+ _discordClient . ChannelDestroyed += DiscordClientChannelDestroyed ;
34
36
_discordClient . UserJoined += DiscordClientUserJoined ;
35
37
_discordClient . UserLeft += DiscordClientUserLeft ;
36
38
}
37
39
38
- private async Task DiscordClientGuildAvailable ( SocketGuild arg )
40
+ private async Task DiscordClientGuildAvailable ( SocketGuild guild )
39
41
{
40
- _Guild = arg ;
42
+ _Guild = guild ;
41
43
_GuildChannelIds . AddRange ( _Guild . Channels . Select ( channel => channel . Id ) ) ;
42
44
_TextChannel = _Guild . Channels . FirstOrDefault ( channel => channel . Id == _settings . DiscordTextChannelId ) as ISocketMessageChannel ;
43
45
_isReady = true ;
44
46
}
45
47
46
- private async Task DiscordClientGuildUnavailable ( SocketGuild arg )
48
+ private async Task DiscordClientGuildUnavailable ( SocketGuild guild )
47
49
{
48
50
_Guild = null ;
49
51
_GuildChannelIds . Clear ( ) ;
50
52
_isReady = false ;
51
53
}
52
54
55
+ private async Task DiscordClientChannelCreated ( SocketChannel newChannel )
56
+ {
57
+ _GuildChannelIds . Add ( newChannel . Id ) ;
58
+ }
59
+
60
+ private async Task DiscordClientChannelDestroyed ( SocketChannel oldChannel )
61
+ {
62
+ _GuildChannelIds . Remove ( oldChannel . Id ) ;
63
+ }
64
+
53
65
private async Task DiscordClientMessageReceived ( SocketMessage arg )
54
66
{
55
67
var message = arg as SocketUserMessage ;
You can’t perform that action at this time.
0 commit comments