11# Preparing your Environment
22
3- This section describes the most common way to prepare a system for Hangoutsbot and
4- get it up and running.
5-
6- ** Docker Users:** See the the end of this file for the ** Docker Usage** section.
7-
8- 1 . Ensure that your system has Python 3.4.2 or newer - we recommend Python 3.5. It's
9- most likely already installed on your system if you are using a fairly new Linux
10- distribution. The Python package manager ` pip3 ` is also required and is usually
11- shipped with whatever version of Python your system comes with.
12- * To check for the existence and versions of both the language and package manager,
13- you can run the following commands at your terminal:
14- * ` python3 --version `
15- * ` pip3 --version `
16- * For systems that don't have Python 3 pre-installed, it is usually available as a
17- package that you can install
18- (e.g. ` sudo apt-get install python3 python3-pip ` on Debian/Ubuntu).
19- We do not provide any further guidance for installation as this is beyond the
20- scope of the Hangoutsbot documentation and there are plenty of online resources
21- which can cover more use-cases and OSes than we can ;)
22- 2 . Clone the repository:
23-
24- ```
25- git clone <repository url>
26- ```
27-
28- 3 . Install the Python module dependencies that Hangoutsbot requires:
29-
30- ```
31- cd hangoutsbot
32- pip3 install -r requirements.txt
33- ```
34-
35- 4 . Run the program interactively for the first time - this topic is covered in the next
36- section, so please go through it carefully.
37- 5 . Set up the bot to be run as a daemon/service so that it can run unattended and
38- survive system reboots. This is an opiniated topic with plenty of different
39- implementation methods. When you're ready, some scripts are available at the
40- following links:
41- * https://github.com/hangoutsbot/hangoutsbot/tree/master/examples
42- * https://github.com/hangoutsbot/hangoutsbot/issues/69
3+ This section describes the most common way to prepare a system for Hangoutsbot
4+ and get it up and running.
5+
6+ ** Docker Users:** See the [ ** Docker Usage** ] ( #docker-usage ) section.
7+
8+ 1 . Ensure that your system has Python 3.5.0 or newer. It's most likely already
9+ installed on your system if you are using a fairly new Linux distribution.
10+
11+ * To check for the existence and version of the language, you can run the
12+ following commands at your terminal:
13+ * ` python3 --version `
14+ * For systems that don't have Python 3 pre-installed, it is usually
15+ available as a package that you can install
16+ (e.g. ` sudo apt-get install python3 python3-pip ` on Debian/Ubuntu).
17+ We do not provide any further guidance for installation as this is beyond
18+ the scope of the Hangoutsbot documentation and there are plenty of online
19+ resources which can cover more use-cases and OSes than we can.
20+
21+ 2 . Clone the repository:
22+
23+ ```
24+ git clone https://github.com/das7pad/hangoutsbot.git hangoutsbot
25+ cd hangoutsbot
26+ ```
27+
28+ 3. Create a Virtual Environment to ensure that no other packages change the
29+ versions of packages we require:
30+
31+ ```
32+ python3 -m venv venv
33+ ```
34+
35+ 3. Install the Python module dependencies that Hangoutsbot requires:
36+
37+ ```
38+ ./venv/bin/pip3 install -r requirements.txt
39+ ```
40+
41+ 4. Run the program interactively for the first time - this topic is covered in
42+ the next section, so please go through it carefully.
43+
44+ 5. Set up the bot to be run as a daemon/service so that it can run unattended
45+ and survive system reboots. This is an opiniated topic with plenty of
46+ different implementation methods. When you're ready, some scripts are
47+ available at the following links:
48+ * [/examples](/examples)
49+ * https://github.com/hangoutsbot/hangoutsbot/issues/69
4350
4451# First-Run
4552
46- You need to ** run the bot for the first time** . You will need at least
47- two gmail accounts: one is your actual account, the other will be your
48- bot account.
53+ You need to **run the bot for the first time**. You will need at least two gmail
54+ accounts: one is your actual account, the other will be your bot account.
4955
50- The basic syntax for running the bot (assuming you are in the root
51- of the cloned repository) is:
56+ The basic syntax for running the bot (assuming you are in the root of the cloned
57+ repository) is:
5258```
53- python3 hangupsbot/hangupsbot.py
59+ ./venv/bin/ python3 hangupsbot/hangupsbot.py
5460```
55- See https://github.com/tdryer/hangups/issues/260#issuecomment-246578670 for getting auth code
5661
57- If you are having problems starting the bot, appending a ` -d ` at the
58- end will dump more details into the bot logs e.g.
59- ` python3 hangupsbot/hangupsbot.py -d ` - more configuration
60- directives can be found at the end of the README file .
62+ You will be prompted for your gmail username and password. Use your bot account
63+ credentials. If the login is sucessful, you will see additional logs about
64+ plugins being loaded. The credentials will be saved in an access token so that
65+ running the bot again will not prompt you for username and password again .
6166
62- You will be prompted for your gmail username and password. Use your
63- bot account credentials. If the login is sucessful, you will see
64- additional logs about plugins being loaded. The credentials will be
65- saved so that running the bot again will not prompt you for username
66- and password again.
67+ To quit the bot from the console, press `CTRL+C`
6768
68- To quit the bot from the console, press CTRL-C
69+ If you are having problems starting the bot, see
70+ [Troubleshooting](#troubleshooting) or [Debugging](README.md#debugging).
6971
7072# Initial Configuration
7173
72- DO NOT EDIT the ` config.json ` supplied with the bot. It is the
73- reference file used to generate the actual config file, which
74- is located elsewhere. Please see the next section on
75- ** Additional Configuration** to get the location of the
76- actual configuration file if you need to edit it manually.
74+ DO NOT EDIT the `config.json` supplied with the repository. It is the reference
75+ file used to generate the actual config file, which is located elsewhere.
76+ Please see the next section on **Additional Configuration** to get the
77+ location of the actual configuration file if you need to edit it manually.
7778
7879You will need to add your actual Hangouts user as a bot administrator.
7980
80- This will be accomplished using the supplied ** starter** plugin with
81- the default supplied configuration.
81+ This will be accomplished using the supplied **starter** plugin with the default
82+ supplied configuration.
8283
83- 1 . Using a hangouts client and your actual gmail account, open a
84- hangout with the bot account.
85- 2 . Send any message to the bot from your own gmail account.
86- 3 . On a browser, login into the bot's gmail account and ensure chat
87- is activated. Accept the invite (and message) from your own gmail
88- account.
89- 4 . Back on your hangouts client, send the following message:
90- ` /bot iamspartacus `
91- 5 . The bot should reply with "configuring first admin" or a similar
92- message.
84+ 1. Using a hangouts client and your actual gmail account, open a hangout with
85+ the bot account.
86+ 2. Send any message to the bot from your own gmail account.
87+ 3. On a browser, login into the bot's gmail account and ensure chat
88+ is activated. Accept the invite (and message) from your own gmail account.
89+ 4. Back on your hangouts client, send the following message:
90+ `/bot iamspartacus`
91+ 5. The bot should reply with "configuring first admin" or a similar
92+ message.
9393
9494# Additional Configuration
9595
96- After the first successful run of the bot, it should generate a
96+ After the first successful run of the bot, it should generate a
9797 `config.json` somewhere in your user directory.
9898
99- You should be able to find it in:
100- ` /<username>/.local/share/hangupsbot/ ` , where <username > is your
101- operating system username.
99+ You should be able to find it in:
100+ `/<username>/.local/share/hangupsbot/`, where ` <username>` is your operating
101+ system username.
102102
103- You can edit this file and restart the bot to load any new configs.
103+ You can edit this file and reload any new configs by
104+ * sending the message `/bot reload` in a hangout with the bot account
105+ * restarting the bot
104106
105- For further information, please see the README file and wiki.
107+ For further information, please see the [ README file](README.md) and wiki.
106108
107109# Troubleshooting
108110
109- * For console output when the bot is starting, errors messages always
110- start in ALLCAPS e.g. "EXCEPTION in ..."
111- * Additional logs can be found in:
112- ` /<username>/.local/share/hangupsbot/hangupsbot.log ` -
111+ * Check the console output and search the Issue lists
112+ * [upstream](https://github.com/hangoutsbot/hangoutsbot/issues?q=is%3Aissue)
113+ * [local](https://github.com/das7pad/hangoutsbot/issues?q=is%3Aissue)
114+ * Additional logs can be found in:
115+ `/<username>/.local/share/hangupsbot/hangupsbot.log`
116+
113117 note: this file is more useful for developers and may be quite verbose
114- * You can verify the location of your active ` config.json ` by sending
115- the following command to the bot via hangouts: ` /bot files ` (with
116- the ** starter** plugin active)
118+ * You can verify the location of your active `config.json` by sending the
119+ following command to the bot via hangouts: `/bot files` (with the
120+ **starter** plugin active)
117121
118122
119123# Docker Usage
120124
121- The bot can be run inside a docker container if desired.
122- You will need to create a directory outside the container to contain
123- configuration and storage data, and if you are using sinks, you may
124- need to change the ports we expose from the container (the defaults
125- are 9000, 9001, and 9002):
125+ The bot can be run inside a docker container if desired. You will need to create
126+ a directory outside the container to contain configuration and storage data, and
127+ if you are using sinks, you may need to change the ports we expose from the
128+ container (the defaults are 9000, 9001, and 9002):
126129
127130You will first need to build the image:
128131
@@ -134,11 +137,11 @@ If you need to change ports add `--build-arg PORTS="new port list"`, for
134137example:
135138
136139```
137- docker build -t hangoutsbot/hangoutsbot --build-arg PORTS="9000 9001 9002 9003 9004" .
140+ docker build -t hangoutsbot/hangoutsbot --build-arg PORTS="9003 9004 9005 " .
138141```
139142
140- Then you can run the image, any arguments starting with a "-" will be passed after
141- the image name will be passed on to the bot (e.g. ` -d ` for debug):
143+ Then you can run the image, any arguments starting with a "-" after the image
144+ name will be passed on to the bot (e.g. `-d` for debug):
142145
143146To run interactively, and in debug mode:
144147
0 commit comments