you didn't see anything

master
Rachel Fae Fox 2022-11-10 19:41:03 -05:00
parent 1bd4e6a6c5
commit 93fa51a9b6
13 changed files with 32 additions and 32 deletions

View File

@ -1,4 +1,4 @@
# CarrierPidgeon
# Homing Pigeon
Relay your discord server to irc via avian carrier.
@ -8,7 +8,7 @@ you need to configure this with a dev.exs / prod.exs like such
```elixir
import Config
config :discordirc,
config :homingpigeon,
channels: [
%{ircnetwork: "net1",
ircchannel: "#mychannel",

View File

@ -1,6 +1,6 @@
import Config
config :carrierpidgeon,
config :homingpigeon,
channels: [
],
networks: [

View File

@ -1,10 +1,10 @@
defmodule CarrierPidgeon.DiscordHandler do
defmodule HomingPigeon.DiscordHandler do
@moduledoc """
discord bot
"""
use Nostrum.Consumer
alias Nostrum.Api
alias CarrierPidgeon.ChannelMap
alias HomingPigeon.ChannelMap
def start_link do
Consumer.start_link(__MODULE__)

View File

@ -1,4 +1,4 @@
defmodule CarrierPidgeon.DiscordInfo do
defmodule HomingPigeon.DiscordInfo do
@moduledoc """
helper functions for discord text things
"""

View File

@ -1,4 +1,4 @@
defmodule CarrierPidgeon.WebhookService do
defmodule HomingPigeon.WebhookService do
@moduledoc """
This module manages the webhooks that we output
to discord channels with
@ -29,7 +29,7 @@ defmodule CarrierPidgeon.WebhookService do
case DiscordAPI.create_webhook(
channel_id,
%{name: "CarrierPidgeon relay hook", avatar: avatar},
%{name: "HomingPigeon relay hook", avatar: avatar},
"irc relay hook"
) do
{:ok, hook} ->

View File

@ -1,12 +1,12 @@
defmodule CarrierPidgeon do
defmodule HomingPigeon do
@moduledoc """
Entrypoint
"""
use Application
alias CarrierPidgeon.IrcNetworkSupervisor
alias CarrierPidgeon.DiscordHandler
alias CarrierPidgeon.WebhookService
alias HomingPigeon.IrcNetworkSupervisor
alias HomingPigeon.DiscordHandler
alias HomingPigeon.WebhookService
def start(_type, _args) do
children = [

View File

@ -1,10 +1,10 @@
defmodule CarrierPidgeon.ChannelMap do
defmodule HomingPigeon.ChannelMap do
@moduledoc """
maps discord channels to irc channels
"""
def discord(network, channel) do
id =
Application.fetch_env!(:carrierpidgeon, :channels)
Application.fetch_env!(:homingpigeon, :channels)
|> Enum.filter(&(&1.ircnetwork == network and &1.ircchannel == channel))
|> List.first()
@ -19,7 +19,7 @@ defmodule CarrierPidgeon.ChannelMap do
def irc(id) do
channel =
Application.fetch_env!(:carrierpidgeon, :channels)
Application.fetch_env!(:homingpigeon, :channels)
|> Enum.filter(&(&1.discordid == id))
|> List.first()
@ -33,7 +33,7 @@ defmodule CarrierPidgeon.ChannelMap do
end
def getircchannels(network) do
Application.fetch_env!(:carrierpidgeon, :channels)
Application.fetch_env!(:homingpigeon, :channels)
|> Enum.filter(&(&1.ircnetwork == network))
|> Enum.map(& &1.ircchannel)
end

View File

@ -1,8 +1,8 @@
defmodule CarrierPidgeon.Formatter do
defmodule HomingPigeon.Formatter do
@moduledoc """
Transforms messages to/from discord from/to irc
"""
alias CarrierPidgeon.DiscordInfo
alias HomingPigeon.DiscordInfo
@discordcdn "https://cdn.discordapp.com/"

View File

@ -1,10 +1,10 @@
defmodule CarrierPidgeon.IRC do
defmodule HomingPigeon.IRC do
@moduledoc """
IRC bot portion
"""
use GenServer
require Logger
import CarrierPidgeon.ByteSplit
import HomingPigeon.ByteSplit
defmodule State do
defstruct server: nil,
@ -32,8 +32,8 @@ defmodule CarrierPidgeon.IRC do
alias ExIRC.Client
alias ExIRC.SenderInfo
alias ExIRC.Whois
alias CarrierPidgeon.ChannelMap
alias CarrierPidgeon.Formatter
alias HomingPigeon.ChannelMap
alias HomingPigeon.Formatter
def start_link(%{:network => network} = params) when is_map(params) do
state = %State{State.from_params(params) | :channels => ChannelMap.getircchannels(network)}

View File

@ -1,11 +1,11 @@
defmodule CarrierPidgeon.IrcNetworkSupervisor do
defmodule HomingPigeon.IrcNetworkSupervisor do
@moduledoc """
Supervises all of the IRC networks.
"""
use Supervisor
alias CarrierPidgeon.IRC
alias HomingPigeon.IRC
def start_link(init_arg) do
Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
@ -14,7 +14,7 @@ defmodule CarrierPidgeon.IrcNetworkSupervisor do
@impl true
def init(_init_arg) do
networks =
Application.get_env(:carrierpidgeon, :networks)
Application.get_env(:homingpigeon, :networks)
|> Enum.map(&%{start: {IRC, :start_link, [&1]}, id: &1.network})
Supervisor.init(networks, strategy: :one_for_one)

View File

@ -1,4 +1,4 @@
defmodule CarrierPidgeon.ByteSplit do
defmodule HomingPigeon.ByteSplit do
@moduledoc """
Module that splits text by bytes, Unicode Aware.
"""

View File

@ -1,9 +1,9 @@
defmodule CarrierPidgeon.MixProject do
defmodule HomingPigeon.MixProject do
use Mix.Project
def project do
[
app: :carrierpidgeon,
app: :homingpigeon,
version: "0.1.0",
elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
@ -15,7 +15,7 @@ defmodule CarrierPidgeon.MixProject do
# Run "mix help compile.app" to learn about applications.
def application do
[
mod: {CarrierPidgeon, []},
mod: {HomingPigeon, []},
extra_applications: [:logger]
]
end

View File

@ -1,7 +1,7 @@
defmodule CarrierPidgeon.SplitterTest do
defmodule HomingPigeon.SplitterTest do
use ExUnit.Case
import CarrierPidgeon.ByteSplit
doctest CarrierPidgeon.ByteSplit
import HomingPigeon.ByteSplit
doctest HomingPigeon.ByteSplit
test "split by bytes" do
assert byte_split("test", 2) == ["te", "st"]