r.ip #7
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ raven.mono
|
||||
pkg/
|
||||
src/
|
||||
.config
|
||||
wiki/
|
||||
|
25
Makefile
25
Makefile
@ -5,12 +5,6 @@ SCRIPTS != ls -1 *.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 ""
|
||||
|
||||
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
|
||||
source $$PWD/installscript && pre_install || true
|
||||
install -o raven -g raven -m 0750 -d ${INSTALLDIR}
|
||||
@ -22,15 +16,26 @@ install: compile
|
||||
mkdir -p ${pkgdir}/usr/lib/systemd/system/
|
||||
cp ./raven.service ${pkgdir}/usr/lib/systemd/system/raven.service
|
||||
|
||||
reverse: /usr/lib/systemd/system/raven.service /usr/local/etc/TheRaven
|
||||
cp /usr/lib/systemd/system/raven.service .
|
||||
cp ${INSTALLDIR}/*.bash .
|
||||
clean:
|
||||
for i in raven.mono; do if [ -f $$i ]; then rm $$i; fi; done
|
||||
|
||||
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
|
||||
chown -R raven:raven ${INSTALLDIR} ${CONFDIR}
|
||||
chmod 0600 ${INSTALLDIR}/* ${CONFDIR}/*
|
||||
chmod 0700 ${CONFDIR} ${INSTALLDIR}
|
||||
|
||||
diff:
|
||||
diff:
|
||||
diff ./raven.service ${pkgdir}/usr/lib/systemd/system/raven.service
|
||||
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=()
|
||||
provides=("${pkgname}")
|
||||
conflicts=()
|
||||
replaces=("${pkgname,,}", "aninix-${pkgname,,}")
|
||||
replaces=("${pkgname,,}" "aninix-${pkgname,,}")
|
||||
backup=()
|
||||
options=()
|
||||
install=installscript
|
||||
|
33
README.md
33
README.md
@ -1,16 +1,37 @@
|
||||
This is a simple IRCbot for the AniNIX's operations.
|
||||
This is a simple IRC bot for the AniNIX's operations.
|
||||
|
||||
# Etymology
|
||||
|
||||
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:
|
||||
|
||||
# Usage
|
||||
To enable this bot, just install the package from [the AniNIX repository](https://maat.aninix.net) or run the following:
|
||||
```
|
||||
make
|
||||
sudo make install
|
||||
sudo systemctl start raven.service
|
||||
sudo systemctl enable raven.service
|
||||
sudo systemctl enable --now 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
|
||||
This IRCbot 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.
|
||||
|
||||
Administrative functions are controlled by the access lists and can be found with `r.adminhelp`.
|
||||
|
||||
|
@ -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)))) {
|
||||
IRCClientMessage send = new IRCClientMessage();
|
||||
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");
|
||||
send.PrivMsg(aliceResponse,(response.target.Equals(Nick))?response.user:response.target);
|
||||
} catch (Exception e) {
|
||||
|
@ -84,7 +84,7 @@ namespace AniNIX.TheRaven {
|
||||
if (bySpace.Length < 2) {
|
||||
|
||||
} 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);
|
||||
return;
|
||||
@ -127,7 +127,7 @@ namespace AniNIX.TheRaven {
|
||||
connection.Write(send);
|
||||
return;
|
||||
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);
|
||||
return;
|
||||
case "r.searches":
|
||||
|
Loading…
Reference in New Issue
Block a user