forked from zuckerberg/dailybot
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
ea1ad60f1c | |||
1290ddd9a2 | |||
|
835dafbd77 | ||
22a32841d5 | |||
c08d3a9fab |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
drastikbot
|
8
flake.lock
generated
8
flake.lock
generated
@ -17,16 +17,16 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1638239011,
|
"lastModified": 1739758141,
|
||||||
"narHash": "sha256-AjhmbT4UBlJWqxY0ea8a6GU2C2HdKUREkG43oRr3TZg=",
|
"narHash": "sha256-uq6A2L7o1/tR6VfmYhZWoVAwb3gTy7j4Jx30MIrH0rE=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31",
|
"rev": "c618e28f70257593de75a7044438efc1c1fc0791",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "21.11",
|
"ref": "nixos-24.11",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/21.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||||
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
@ -10,7 +10,7 @@
|
|||||||
supportedSystems = with flake-utils.lib.system; [ x86_64-linux i686-linux aarch64-linux ];
|
supportedSystems = with flake-utils.lib.system; [ x86_64-linux i686-linux aarch64-linux ];
|
||||||
in {
|
in {
|
||||||
overlay = final: prev: {
|
overlay = final: prev: {
|
||||||
drastikbot = prev.python3Packages.buildPythonApplication rec {
|
drastikbot = prev.python311.pkgs.buildPythonApplication rec {
|
||||||
pname = "drastikbot";
|
pname = "drastikbot";
|
||||||
version = "v2.1";
|
version = "v2.1";
|
||||||
|
|
||||||
@ -29,8 +29,8 @@
|
|||||||
cp -r $src/src/* $out
|
cp -r $src/src/* $out
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
makeWrapper ${prev.python3}/bin/python3 $out/bin/drastikbot \
|
makeWrapper ${prev.python311}/bin/python3 $out/bin/drastikbot \
|
||||||
--prefix PYTHONPATH : ${with prev.python3Packages; makePythonPath [requests beautifulsoup4]} \
|
--prefix PYTHONPATH : ${with prev.python311.pkgs; makePythonPath [requests beautifulsoup4]} \
|
||||||
--add-flags "$out/drastikbot.py"
|
--add-flags "$out/drastikbot.py"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -74,13 +74,13 @@ def parser():
|
|||||||
" already exists.")
|
" already exists.")
|
||||||
conf_dir = str(path.expanduser().resolve())
|
conf_dir = str(path.expanduser().resolve())
|
||||||
else:
|
else:
|
||||||
path = Path('~/.drastikbot').expanduser()
|
path = Path('./drastikbot').expanduser()
|
||||||
if not path.is_dir():
|
if not path.is_dir():
|
||||||
try:
|
try:
|
||||||
path.mkdir(parents=True, exist_ok=False)
|
path.mkdir(parents=True, exist_ok=False)
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
sys.exit("[Error] Making configuration directory at"
|
sys.exit("[Error] Making configuration directory at"
|
||||||
" '~/.drastikbot' failed. Another file with that name"
|
" './drastikbot' failed. Another file with that name"
|
||||||
" already exists.")
|
" already exists.")
|
||||||
conf_dir = str(path)
|
conf_dir = str(path)
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class Drastikbot():
|
|||||||
# statement below.
|
# statement below.
|
||||||
if multipart:
|
if multipart:
|
||||||
time.sleep(self.var.msg_delay)
|
time.sleep(self.var.msg_delay)
|
||||||
tr = m_len - 2 - len(' '.join(cmds).encode('utf-8')) - remainder
|
tr = m_len - 2 - len(' '.join(cmds).encode('utf-8')) - remainder - 1
|
||||||
t = text.encode('utf-8')[tr:]
|
t = text.encode('utf-8')[tr:]
|
||||||
self.send(cmds, t)
|
self.send(cmds, t)
|
||||||
|
|
||||||
|
@ -269,6 +269,7 @@ def twitter(url):
|
|||||||
hosts_d = {
|
hosts_d = {
|
||||||
"youtube.com": youtube,
|
"youtube.com": youtube,
|
||||||
"youtu.be": youtube,
|
"youtu.be": youtube,
|
||||||
|
"m.youtube.com": youtube,
|
||||||
"lainchan.org": lainchan,
|
"lainchan.org": lainchan,
|
||||||
"i.imgur.com": imgur,
|
"i.imgur.com": imgur,
|
||||||
"imgur.com": imgur,
|
"imgur.com": imgur,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user