r.ip #7
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ raven.mono
|
|||||||
pkg/
|
pkg/
|
||||||
src/
|
src/
|
||||||
.config
|
.config
|
||||||
|
wiki/
|
||||||
|
23
Makefile
23
Makefile
@ -5,12 +5,6 @@ SCRIPTS != ls -1 *.bash
|
|||||||
compile: clean ./chatbot-support.bash ./math-support.bash
|
compile: clean ./chatbot-support.bash ./math-support.bash
|
||||||
(mcs -out:raven.mono /opt/aninix/Uniglot/CSharp/*.csharp *.csharp Raven.csharp 2>&1 | grep -v CS2002); printf ""
|
(mcs -out:raven.mono /opt/aninix/Uniglot/CSharp/*.csharp *.csharp Raven.csharp 2>&1 | grep -v CS2002); printf ""
|
||||||
|
|
||||||
clean:
|
|
||||||
for i in raven.mono; do if [ -f $$i ]; then rm $$i; fi; done
|
|
||||||
|
|
||||||
test: compile
|
|
||||||
cd ./sample-confs; mono ../raven.mono -c sample.conf -v -h
|
|
||||||
|
|
||||||
install: compile
|
install: compile
|
||||||
source $$PWD/installscript && pre_install || true
|
source $$PWD/installscript && pre_install || true
|
||||||
install -o raven -g raven -m 0750 -d ${INSTALLDIR}
|
install -o raven -g raven -m 0750 -d ${INSTALLDIR}
|
||||||
@ -22,9 +16,16 @@ install: compile
|
|||||||
mkdir -p ${pkgdir}/usr/lib/systemd/system/
|
mkdir -p ${pkgdir}/usr/lib/systemd/system/
|
||||||
cp ./raven.service ${pkgdir}/usr/lib/systemd/system/raven.service
|
cp ./raven.service ${pkgdir}/usr/lib/systemd/system/raven.service
|
||||||
|
|
||||||
reverse: /usr/lib/systemd/system/raven.service /usr/local/etc/TheRaven
|
clean:
|
||||||
cp /usr/lib/systemd/system/raven.service .
|
for i in raven.mono; do if [ -f $$i ]; then rm $$i; fi; done
|
||||||
cp ${INSTALLDIR}/*.bash .
|
|
||||||
|
uninstall:
|
||||||
|
rm -Rf ${INSTALLDIR} ${CONFDIR}
|
||||||
|
systemctl disable --now raven.service
|
||||||
|
rm /usr/lib/systemd/system/raven.service
|
||||||
|
|
||||||
|
test: compile
|
||||||
|
cd ./sample-confs; mono ../raven.mono -c sample.conf -v -h
|
||||||
|
|
||||||
checkperm: ${INSTALLDIR}/raven.mono
|
checkperm: ${INSTALLDIR}/raven.mono
|
||||||
chown -R raven:raven ${INSTALLDIR} ${CONFDIR}
|
chown -R raven:raven ${INSTALLDIR} ${CONFDIR}
|
||||||
@ -34,3 +35,7 @@ checkperm: ${INSTALLDIR}/raven.mono
|
|||||||
diff:
|
diff:
|
||||||
diff ./raven.service ${pkgdir}/usr/lib/systemd/system/raven.service
|
diff ./raven.service ${pkgdir}/usr/lib/systemd/system/raven.service
|
||||||
diff ./sample.conf ${pkgdir}/usr/local/etc/TheRaven/raven.conf
|
diff ./sample.conf ${pkgdir}/usr/local/etc/TheRaven/raven.conf
|
||||||
|
|
||||||
|
reverse: /usr/lib/systemd/system/raven.service /usr/local/etc/TheRaven
|
||||||
|
cp /usr/lib/systemd/system/raven.service .
|
||||||
|
cp ${INSTALLDIR}/*.bash .
|
||||||
|
2
PKGBUILD
2
PKGBUILD
@ -17,7 +17,7 @@ license=('custom')
|
|||||||
groups=()
|
groups=()
|
||||||
provides=("${pkgname}")
|
provides=("${pkgname}")
|
||||||
conflicts=()
|
conflicts=()
|
||||||
replaces=("${pkgname,,}", "aninix-${pkgname,,}")
|
replaces=("${pkgname,,}" "aninix-${pkgname,,}")
|
||||||
backup=()
|
backup=()
|
||||||
options=()
|
options=()
|
||||||
install=installscript
|
install=installscript
|
||||||
|
29
README.md
29
README.md
@ -1,14 +1,35 @@
|
|||||||
This is a simple IRC bot for the AniNIX's operations.
|
This is a simple IRC bot for the AniNIX's operations.
|
||||||
|
|
||||||
# Usage
|
# Etymology
|
||||||
To enable this bot, just install the package from [the AniNIX repository](https://maat.aninix.net) or run the following:
|
|
||||||
|
The Raven is a named after the [common raven](https://en.wikipedia.org/wiki/Raven) by [DarkFeather](/DarkFeather). There's a lot of history there, but it's effectively that user's namesake & avatar.
|
||||||
|
|
||||||
|
# Relevant Files and Software
|
||||||
|
|
||||||
|
The Raven's source code can be compiled into a deployable agent. To enable this bot, just install the package from [the AniNIX repository](https://maat.aninix.net) or run the following:
|
||||||
|
|
||||||
```
|
```
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
sudo systemctl start raven.service
|
sudo systemctl enable --now raven.service
|
||||||
sudo systemctl enable raven.service
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The configuration lives in `/usr/local/etc/TheRaven`. Unique files are provided for logins, search functions, help text, CrowFacts and magic8 functions, etc.
|
||||||
|
|
||||||
|
TheRaven is dependent on /bin/bash and [wget](https://wiki.archlinux.org/index.php/Wget) for the TinyURL features. It is dependent on the [Mono](https://wiki.archlinux.org/index.php/Mono) package for compiling on Linux.
|
||||||
|
|
||||||
|
TheRaven also expects an OS script, `api-keys`, that will return a TinyURL API key when run with the `tinyurl` parameter.
|
||||||
|
|
||||||
|
# Available Clients
|
||||||
|
|
||||||
|
There are no direct clients -- connect to [IRC](https://irc.aninix.net) or our Discord bridge. Use `r.help` in any channel where TheRaven is present to find out what it can do, or PM it directly.
|
||||||
|
|
||||||
|
# Equivalents or Competition
|
||||||
|
|
||||||
|
[Sopel](https://sopel.chat/) is an equivalent, maintained IRC bot. We maintain our own for the use case of testing code development.
|
||||||
|
|
||||||
|
Various Discord bots also perform the same function.
|
||||||
|
|
||||||
# Functionality
|
# Functionality
|
||||||
This IRC bot has some simple commands that can be found by most users with `r.help` in whatever channel the bot has joined.
|
This IRC bot has some simple commands that can be found by most users with `r.help` in whatever channel the bot has joined.
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ namespace AniNIX.TheRaven {
|
|||||||
if (response.msgCode.Equals("PRIVMSG") && !String.IsNullOrWhiteSpace(response.message) && (response.target.Equals(Nick) || response.message.StartsWith(String.Format("{0}:",Nick)) || response.message.EndsWith(String.Format("{0}!",Nick)) || response.message.EndsWith(String.Format("{0}?",Nick)) || response.message.EndsWith(String.Format("{0}.",Nick)) || response.message.EndsWith(String.Format("{0}",Nick)))) {
|
if (response.msgCode.Equals("PRIVMSG") && !String.IsNullOrWhiteSpace(response.message) && (response.target.Equals(Nick) || response.message.StartsWith(String.Format("{0}:",Nick)) || response.message.EndsWith(String.Format("{0}!",Nick)) || response.message.EndsWith(String.Format("{0}?",Nick)) || response.message.EndsWith(String.Format("{0}.",Nick)) || response.message.EndsWith(String.Format("{0}",Nick)))) {
|
||||||
IRCClientMessage send = new IRCClientMessage();
|
IRCClientMessage send = new IRCClientMessage();
|
||||||
try {
|
try {
|
||||||
String aliceResponse = ExecuteCommand.Run(String.Format("bash ./chatbot-support.bash \"{0}\" {1}",response.message.Replace("'","").Replace("\"","").Split('\n')[0].Trim(),Nick)).Trim();
|
String aliceResponse = ExecuteCommand.Run(String.Format("bash /opt/aninix/TheRaven/chatbot-support.bash \"{0}\" {1}",response.message.Replace("'","").Replace("\"","").Split('\n')[0].Trim(),Nick)).Trim();
|
||||||
if (String.IsNullOrWhiteSpace(aliceResponse)) throw new Exception("No response from ALICE chatbot service");
|
if (String.IsNullOrWhiteSpace(aliceResponse)) throw new Exception("No response from ALICE chatbot service");
|
||||||
send.PrivMsg(aliceResponse,(response.target.Equals(Nick))?response.user:response.target);
|
send.PrivMsg(aliceResponse,(response.target.Equals(Nick))?response.user:response.target);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -84,7 +84,7 @@ namespace AniNIX.TheRaven {
|
|||||||
if (bySpace.Length < 2) {
|
if (bySpace.Length < 2) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
send.PrivMsg(ExecuteCommand.Run(String.Format("/bin/bash /usr/local/src/TheRaven/math-support.bash \"{0}\"",incoming.message.Replace("r.math ","").Replace("'","").Replace("\"",""))),(incoming.target.Equals(theRaven.Nick))?incoming.user:incoming.target);
|
send.PrivMsg(ExecuteCommand.Run(String.Format("/bin/bash /opt/aninix/TheRaven/math-support.bash \"{0}\"",incoming.message.Replace("r.math ","").Replace("'","").Replace("\"",""))),(incoming.target.Equals(theRaven.Nick))?incoming.user:incoming.target);
|
||||||
}
|
}
|
||||||
connection.Write(send);
|
connection.Write(send);
|
||||||
return;
|
return;
|
||||||
@ -127,7 +127,7 @@ namespace AniNIX.TheRaven {
|
|||||||
connection.Write(send);
|
connection.Write(send);
|
||||||
return;
|
return;
|
||||||
case "r.ip":
|
case "r.ip":
|
||||||
send.PrivMsg(ExecuteCommand.Run("curl -s $(ip r list | grep default | cut -f 3 -d \" \"):80 | grep \"WAN IP\" | cut -f 13 -d \">\" | cut -f 1 -d \"<\""),(incoming.target.Equals(theRaven.Nick))?incoming.user:incoming.target);
|
send.PrivMsg(ExecuteCommand.Run("/bin/bash /opt/aninix/TheRaven/ip.bash"),(incoming.target.Equals(theRaven.Nick))?incoming.user:incoming.target);
|
||||||
connection.Write(send);
|
connection.Write(send);
|
||||||
return;
|
return;
|
||||||
case "r.searches":
|
case "r.searches":
|
||||||
|
Loading…
Reference in New Issue
Block a user