Skip to content

Commit

Permalink
init: git init
Browse files Browse the repository at this point in the history
  • Loading branch information
NtskwK committed Sep 15, 2024
0 parents commit 27bdab4
Show file tree
Hide file tree
Showing 8 changed files with 684 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
venv

*.pyc
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ubuntu:22.04

RUN apt-get -o Acquire::Retries=3 update && \
apt-get -o Acquire::Retries=3 install -y --no-install-recommends git python3 python3-pip curl && \
pip install iamai[onebot] && \
pip install iamai-adapter-apscheduler && \
iamai new iamai && cd iamai

COPY main.py /iamai
COPY config.toml /iamai
COPY docker-entrypoint.sh /iamai

WORKDIR /iamai
EXPOSE 3001
STOPSIGNAL SIGINT
ENTRYPOINT ["bash", "docker-entrypoint.sh"]
13 changes: 13 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[bot]
plugin_dirs = ["plugins"]
adapters = ["iamai.adapter.cqhttp"]

[bot.log]
level = "INFO"
verbose_exception = true

[adapter.cqhttp]
adapter_type = "ws-reverse"
host = "0.0.0.0"
port = 3001
url = "/cqhttp/ws"
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "3"
services:
napcat:
image: mlikiowa/napcat-docker:latest
container_name: napcat
environment:
- ACCOUNT=
- WSR_ENABLE=true
# 如果是正向ws,将本项注释掉即可
- WS_URLS=["ws://iamai:3001/cqhttp/ws"]
- NAPCAT_UID=1000
- NAPCAT_GID=1000
ports:
- 6099:6099
- 3001:3001
restart: always
# 如果是重新创建的容器,需要固定 Mac 地址
mac_address: 02:42:ac:11:00:99
volumes:
- ./qqdata:/app/.config/QQ
- ./napcat/config:/app/napcat/config
- ./napcat/logs:/app/napcat/logs
iamai:
image: kuron/iamai-cqhttp:su
container_name: iamai
expose:
- "3001"
volumes:
- ./plugins:/iamai/plugins

17 changes: 17 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

function install_from_requirements() {
local dir=$1
for file in "$dir"/*; do
if [ -d "$file" ]; then
install_from_requirements "$file"
elif [ "$file" == "$dir/requirements.txt" ]; then
echo "Installing packages from $file"
pip install -r "$file"
fi
done
}

install_from_requirements "plugins"

python3 main.py
7 changes: 7 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from iamai import Bot

bot = Bot()

if __name__ == '__main__':
print(bot.config)
bot.run()
Loading

0 comments on commit 27bdab4

Please sign in to comment.