forked from zuckerberg/dailybot
Combine source files
This commit is contained in:
parent
befb55fff3
commit
2e07bbb710
36
flake.lock
generated
36
flake.lock
generated
@ -1,39 +1,5 @@
|
||||
{
|
||||
"nodes": {
|
||||
"drastikbot": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1596211584,
|
||||
"narHash": "sha256-1L8vTE1YEhFWzY5RYb+s5Hb4LrVJNN2leKlZEugEyRU=",
|
||||
"owner": "olagood",
|
||||
"repo": "drastikbot",
|
||||
"rev": "ef72e3afe7602d95c8b014202e220f04796900ab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "olagood",
|
||||
"ref": "v2.1",
|
||||
"repo": "drastikbot",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"drastikbot_modules": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1619214744,
|
||||
"narHash": "sha256-w1164FkRkeyWnx6a95WDbwEUvNkNwFWa/6mhKtgVw0c=",
|
||||
"owner": "olagood",
|
||||
"repo": "drastikbot_modules",
|
||||
"rev": "3af549a8c3f6e55b63758a61a751bebb1b2db3a3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "olagood",
|
||||
"ref": "v2.1",
|
||||
"repo": "drastikbot_modules",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1648297722,
|
||||
@ -67,8 +33,6 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"drastikbot": "drastikbot",
|
||||
"drastikbot_modules": "drastikbot_modules",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
|
36
flake.nix
36
flake.nix
@ -3,14 +3,9 @@
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/21.11";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
drastikbot.url = "github:olagood/drastikbot/v2.1";
|
||||
drastikbot.flake = false;
|
||||
drastikbot_modules.url = "github:olagood/drastikbot_modules/v2.1";
|
||||
drastikbot_modules.flake = false;
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, drastikbot, drastikbot_modules, ... }:
|
||||
outputs = { self, nixpkgs, flake-utils, ... }:
|
||||
let
|
||||
supportedSystems = with flake-utils.lib.system; [ x86_64-linux i686-linux aarch64-linux ];
|
||||
in {
|
||||
@ -21,40 +16,19 @@
|
||||
|
||||
format = "other";
|
||||
|
||||
srcs = [
|
||||
self
|
||||
drastikbot
|
||||
drastikbot_modules
|
||||
];
|
||||
src = self;
|
||||
|
||||
nativeBuildInputs = [ prev.makeWrapper ];
|
||||
|
||||
phases = [ "installPhase" ]; # Removes all phases except installPhase
|
||||
|
||||
installPhase = ''
|
||||
arr=($srcs)
|
||||
mkdir -p $out/irc/modules
|
||||
mkdir -p $out
|
||||
|
||||
# install dailybuild_modules
|
||||
cp -r ''${arr[0]}/src/* $out/irc/modules
|
||||
|
||||
# install drastikbot core
|
||||
cp -r ''${arr[1]}/src/* $out/
|
||||
|
||||
# install drastikbot modules
|
||||
cp -r ''${arr[2]}/* $out/irc/modules
|
||||
|
||||
# Patch ".bots" command to include reference to dailybuild_modules
|
||||
sed -i 's|\(http://drastik.org/drastikbot"\)|\1 " https://git.neet.dev/zuckerberg/dailybuild_modules"|' $out/irc/modules/information.py
|
||||
|
||||
# Patch ".source" command to include reference to dailybuild_modules
|
||||
sed -i 's|\(https://github.com/olagood/drastikbot_modules\\x0F"\)|\1 " : \\x0311https://git.neet.dev/zuckerberg/dailybuild_modules\\x0F"|' $out/irc/modules/information.py
|
||||
|
||||
# Patch ".wa" command so that the AppID does not need to be hardcoded into the source code of the program
|
||||
sed -i 's|AppID = "Enter your AppID here"|import pathlib\nimport os\nAppID = pathlib.Path(os.environ["WOLFRAM_ID_FILE"]).read_text()|' $out/irc/modules/wolframalpha.py
|
||||
# copy files
|
||||
cp -r $src/src/* $out
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
||||
makeWrapper ${prev.python3}/bin/python3 $out/bin/drastikbot \
|
||||
--prefix PYTHONPATH : ${with prev.python3Packages; makePythonPath [requests beautifulsoup4]} \
|
||||
--add-flags "$out/drastikbot.py"
|
||||
|
@ -32,12 +32,10 @@ def main(i, irc):
|
||||
m = (f"\x0305,01drastikbot {irc.var.version}\x0F"
|
||||
" | \x0305Python 3.6\x0F"
|
||||
" | \x0305GNU AGPLv3 ONLY\x0F"
|
||||
" | \x0311http://drastik.org/drastikbot")
|
||||
" | \x0311http://drastik.org/drastikbot https://git.neet.dev/zuckerberg/dailybuild_modules")
|
||||
irc.privmsg(i.channel, m)
|
||||
elif i.cmd == "source":
|
||||
if not i.msg_nocmd or i.msg_nocmd == irc.var.curr_nickname:
|
||||
m = ("\x0305,01drastikbot\x0F"
|
||||
" : \x0311https://github.com/olagood/drastikbot\x0F"
|
||||
" | \x0305,01Modules\x0F"
|
||||
" : \x0311https://github.com/olagood/drastikbot_modules\x0F")
|
||||
m = ("\x0305,01drastikbot + drastikbot_modules + dailybuild_modules\x0F"
|
||||
" : \\x0311https://git.neet.dev/zuckerberg/dailybuild_modules\\x0F")
|
||||
irc.privmsg(i.channel, m)
|
||||
|
@ -44,8 +44,9 @@ class Module:
|
||||
}
|
||||
|
||||
|
||||
AppID = "Enter your AppID here"
|
||||
|
||||
import pathlib
|
||||
import os
|
||||
AppID = pathlib.Path(os.environ["WOLFRAM_ID_FILE"]).read_text()
|
||||
|
||||
def short_answers(query):
|
||||
url = f"http://api.wolframalpha.com/v1/result?appid={AppID}&i={query}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user