Skip to content

Commit

Permalink
Deployment Preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
satabie committed Oct 3, 2023
1 parent b37bae4 commit cf50b2b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.11
WORKDIR /bot
COPY requirements.txt /bot/
RUN pip install -r requirements.txt
COPY . /bot
CMD python main.py
Binary file added __pycache__/keep_alive.cpython-310.pyc
Binary file not shown.
Empty file removed hoge.ipynb
Empty file.
15 changes: 15 additions & 0 deletions keep_alive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from flask import Flask
from threading import Thread

app = Flask('')

@app.route('/')
def home():
return "I'm alive"

def run():
app.run(host='0.0.0.0', port=8080)

def keep_alive():
t = Thread(target=run)
t.start()
6 changes: 4 additions & 2 deletions discordbot.py → main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import random
from dotenv import load_dotenv
from keep_alive import keep_alive

# .envファイルから環境変数を読み込み
load_dotenv()
Expand Down Expand Up @@ -32,10 +33,11 @@ async def on_message(message: discord.Message):
image_file = random.choice(image_files)
image_path = os.path.join(image_folder, image_file)
await message.channel.send(file=discord.File(image_path))
elif 'shosei' or "Shosei" or "書生" in message.content:
await message.channel.send("shoseiは寝ています")
elif any(keyword in message.content for keyword in ['shosei', 'Shosei', 'しょせい', '書生']):
await message.channel.send("書生は寝ています")



# ボットを実行
keep_alive()
bot.run(TOKEN)
18 changes: 18 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
aiohttp==3.8.5
aiosignal==1.3.1
async-timeout==4.0.3
attrs==23.1.0
blinker==1.6.2
charset-normalizer==3.3.0
click==8.1.7
discord.py==2.3.2
Flask==3.0.0
frozenlist==1.4.0
idna==3.4
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.3
multidict==6.0.4
python-dotenv==1.0.0
Werkzeug==3.0.0
yarl==1.9.2
1 change: 0 additions & 1 deletion tempCodeRunnerFile.py

This file was deleted.

0 comments on commit cf50b2b

Please sign in to comment.