Skip to content

Commit

Permalink
Added thread support
Browse files Browse the repository at this point in the history
  • Loading branch information
ishauny authored and ishauny committed Dec 18, 2023
1 parent 86f30b6 commit 4350c1c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Floofbot/Services/EventHandlerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public EventHandlerService(DiscordSocketClient client)
_client.MessageReceived += OnMessage;
_client.MessageReceived += RulesGate; // rfurry rules gate
_client.ReactionAdded += _nicknameAlertService.OnReactionAdded;
_client.ThreadCreated += NewThread;
_client.ThreadUpdated += UpdatedThread;

// a list of announcement channels for auto publishing
announcementChannels = BotConfigFactory.Config.AnnouncementChannels;
Expand Down Expand Up @@ -147,6 +149,21 @@ public async Task RulesGate(SocketMessage msg)
await userMsg.DeleteAsync();
}
}
public async Task NewThread(SocketThreadChannel thread)
{
await thread.JoinAsync();
return;
}
public async Task UpdatedThread(Cacheable<SocketThreadChannel, ulong> channel, SocketThreadChannel thread)
{
if (thread != null)
{
if (thread.HasJoined != true)
{
await thread.JoinAsync();
}
}
}
public Task OnMessage(SocketMessage msg)
{
if (msg.Channel.GetType() == typeof(SocketDMChannel))
Expand Down

0 comments on commit 4350c1c

Please sign in to comment.