{"action":"opened","issue":{"url":"https://api.github.com/repos/gdamjan/erlang-irc-bot/issues/55","labels_url":"https://api.github.com/repos/gdamjan/erlang-irc-bot/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/gdamjan/erlang-irc-bot/issues/55/comments","events_url":"https://api.github.com/repos/gdamjan/erlang-irc-bot/issues/55/events","html_url":"https://github.com/gdamjan/erlang-irc-bot/issues/55","id":112653991,"number":55,"title":"Example on how to use as rebar dep","user":{"login":"joekinley","id":1299927,"avatar_url":"https://avatars.githubusercontent.com/u/1299927?v=3","gravatar_id":"","url":"https://api.github.com/users/joekinley","html_url":"https://github.com/joekinley","followers_url":"https://api.github.com/users/joekinley/followers","following_url":"https://api.github.com/users/joekinley/following{/other_user}","gists_url":"https://api.github.com/users/joekinley/gists{/gist_id}","starred_url":"https://api.github.com/users/joekinley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joekinley/subscriptions","organizations_url":"https://api.github.com/users/joekinley/orgs","repos_url":"https://api.github.com/users/joekinley/repos","events_url":"https://api.github.com/users/joekinley/events{/privacy}","received_events_url":"https://api.github.com/users/joekinley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-21T18:45:32Z","updated_at":"2015-10-21T18:45:32Z","closed_at":null,"body":"So I am working on an app, that uses this erlang-irc-bot as a dep through rebar. And I want to run the bot in my app through a gen_server, but I just can't seem to be able to make it happen:\r\n\r\n```\r\n% in the init of my gen_server\r\ninit(Args) ->\r\n    io:setopts([{encoding, unicode}]),\r\n    {ok, [{connection, Settings}]} = file:consult(\"settings.cfg\"),\r\n    IrcBot = ircbot_fsm:new_link(Settings),\r\n    register(ircbot, IrcBot:pid()),\r\n    IrcBot:connect(),\r\n    {ok, Args}.\r\n```\r\n\r\nAnd this doesn't work, as I get \r\n```\r\n=CRASH REPORT==== 21-Oct-2015::20:43:07 ===\r\n  crasher:\r\n    initial call: cassadeey_server:init/1\r\n    pid: <0.49.0>\r\n    registered_name: []\r\n    exception exit: {badarg,\r\n                        [{erlang,register,[ircbot,<0.51.0>],[]},\r\n                         {cassadeey_server,init,1,\r\n                             [{file,\"src/cassadeey_server.erl\"},{line,33}]},\r\n                         {gen_server,init_it,6,\r\n                             [{file,\"gen_server.erl\"},{line,328}]},\r\n                         {proc_lib,init_p_do_apply,3,\r\n                             [{file,\"proc_lib.erl\"},{line,239}]}]}\r\n      in function  gen_server:init_it/6 (gen_server.erl, line 352)\r\n    ancestors: [cassadeey_sup,<0.47.0>]\r\n    messages: []\r\n    links: [<0.48.0>,<0.51.0>]\r\n    dictionary: []\r\n    trap_exit: false\r\n    status: running\r\n    heap_size: 987\r\n    stack_size: 27\r\n    reductions: 1840\r\n  neighbours:\r\n    neighbour: [{pid,<0.55.0>},\r\n                  {registered_name,[]},\r\n                  {initial_call,{ircbot_connection,connect,4}},\r\n                  {current_function,{code_server,call,2}},\r\n                  {ancestors,[]},\r\n                  {messages,[]},\r\n                  {links,[<0.51.0>]},\r\n                  {dictionary,[]},\r\n                  {trap_exit,false},\r\n                  {status,waiting},\r\n                  {heap_size,233},\r\n                  {stack_size,10},\r\n                  {reductions,8}]\r\n    neighbour: [{pid,<0.51.0>},\r\n                  {registered_name,slack},\r\n                  {initial_call,{ircbot_fsm,init,['Argument__1']}},\r\n                  {current_function,{io,execute_request,2}},\r\n                  {ancestors,[cassadeey_server,cassadeey_sup,<0.47.0>]},\r\n                  {messages,[]},\r\n                  {links,[<0.52.0>,<0.55.0>,<0.49.0>]},\r\n                  {dictionary,[]},\r\n                  {trap_exit,false},\r\n                  {status,waiting},\r\n                  {heap_size,233},\r\n                  {stack_size,23},\r\n                  {reductions,184}]\r\n\r\n```\r\n\r\nAm I doing something wrong?"}}