Added Dockerfile
This commit is contained in:
parent
297750f41f
commit
8d82181449
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM python:3.11
|
||||
|
||||
ADD main.py .
|
||||
ADD requirements.txt .
|
||||
ADD .env .
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "./main.py"]
|
||||
|
18
main.py
18
main.py
@ -17,7 +17,7 @@ client: Client = Client(intents=intents)
|
||||
|
||||
@client.event
|
||||
async def on_ready() -> None:
|
||||
print('Sentinel ready !')
|
||||
print('Sentinel ready !', flush=True)
|
||||
|
||||
@client.event
|
||||
async def on_message(message: Message) -> None:
|
||||
@ -26,22 +26,24 @@ async def on_message(message: Message) -> None:
|
||||
|
||||
if message.author == client.user:
|
||||
# to avoid infinite loop, let's not answer to messages we (client.user) emit ourselves
|
||||
print('no answer to our own message')
|
||||
print('no answer to our own message', flush=True)
|
||||
return
|
||||
if not user_message:
|
||||
print('no message to send')
|
||||
print('no message to send', flush=True)
|
||||
return
|
||||
if message.channel.id != 1218161058599141386:
|
||||
print('channel not monitored')
|
||||
print('channel not monitored', flush=True)
|
||||
return
|
||||
if 'Kriss' not in user_message:
|
||||
print('message not implying "Kriss"')
|
||||
print('message not implying "Kriss"', flush=True)
|
||||
return
|
||||
|
||||
print(f'[{str(message.channel)}] {str(message.author)}: "{user_message}"')
|
||||
print(f'[{str(message.channel)}] {str(message.author)}: "{user_message}"', flush=True)
|
||||
|
||||
try:
|
||||
await client.get_channel(1256995195954790410).send(user_message)
|
||||
await client.get_channel('1256995195954790410').send(user_message)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print(e, flush=True)
|
||||
|
||||
def main() -> None:
|
||||
client.run(token=TOKEN)
|
||||
|
Loading…
Reference in New Issue
Block a user