-
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Hi! I've followed the configuration and guide, and when I have one bot it works splendidly, we've had all sorts of fun with it, but when I have multiple bot_configs it appears that only the first one connects and relays messages. I've tried with the same account, different accounts, different channels, and whatever the first one to connect is succeeds while the rest do not.
In my Application.ex:
...
children = [
...
{PartitionSupervisor, child_spec: DynamicSupervisor, name: MyApp.DynamicSupervisors}
]
...
# Add the running ones
running_bots = MyApp.Context.Bot.get_all_running!()
bot_configs =
for bot <- running_bots do
# TMI bot config
[
bot: MyApp.Twitchbot,
user: bot.twitch_user,
pass: bot.twitch_pass,
channels: [bot.twitch_channel],
mod_channels: [""],
capabilities: ["membership", "tags", "commands"],
debug: false
]
end
for {bot_config, index} <- Enum.with_index(bot_configs) do
# give TMIs to supervisors
DynamicSupervisor.start_child(
{:via, PartitionSupervisor, {MyApp.DynamicSupervisors, index}},
{TMI.Supervisor, bot_config}
)
end
...
In Twitchbot.ex:
defmodule MyApp.Twitchbot do
use TMI
@impl TMI.Handler
def handle_message(message, sender, chat) do
Logger.debug("Message in #{chat} from #{sender}: #{message}")
end
end
...
I get Logger messages from the first bot to connect, and nothing else.
Snipped for relevance and also to remove a perhaps gratuitous amount of IO.inspect
calls. Just trying to figure out what I've got set up incorrectly here, or what my fundamental misunderstanding is 😅
Thank you for your wonderful library!
Metadata
Metadata
Assignees
Labels
No labels