Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Launch the bot #2

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
venv
scratch
.vscode
.github
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DISCORD_TOKEN="token"
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/01-bot-feature-suggestion.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assignees: ""
---

**Describe your suggested improvement**
Describe what feature you'd like to see for the Discord Bot...
Describe what feature you'd like to see for the Discord bot...

**Describe the benefit**
Describe how this will benefit users of the server (utility, memes, etc)...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
deploy:
if: (github.ref == 'refs/heads/main') && (github.repository == 'ClimateTown/discord-bot')
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write # to verify the deployment originates from an appropriate source
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ venv
.vscode
__pycache__
.pytest_cache
.env
scratch
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.10
LABEL org.opencontainers.image.title="Climate Town Discord Bot"
LABEL org.opencontainers.image.description="Discord Bot used within the Climate Town Discord server."
LABEL org.opencontainers.image.source="https://github.com/ClimateTown/discord-bot"

WORKDIR /code

COPY requirements.txt requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

COPY . .
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://hub.climatetownproductions.com">
<img width="200" src="https://placehold.co/400">
<img width="200" src="./spud.png">
</a>
</p>

Expand All @@ -11,11 +11,11 @@

---

This is the code that runs our custom `<bot name>` bot in the Climate Town Discord server!
This is the code that runs our friendly custom bot (their name is Spud) in the Climate Town Discord server!

## Contributing

Contributions welcome! Suggest features for the bot by [posting an issue](https://github.com/ClimateTown/discord-bot/issues), or by messaging in `🔨server-suggestion-box`.
Contributions welcome! Suggest features for the bot by [posting an issue](https://github.com/ClimateTown/discord-bot/issues/new/choose), or by messaging in `🔨server-suggestion-box`.

Note that bot feature suggestions are approved/dis-approved at the discretion of the moderators (aka. Comptrollers) of the server\*.

Expand Down
27 changes: 27 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import discord
import os
from dotenv import load_dotenv

load_dotenv()

intents = discord.Intents.default()
intents.message_content = True

client = discord.Client(intents=intents)


@client.event
async def on_ready():
print(f"We have logged in as {client.user}")


@client.event
async def on_message(message):
if message.author == client.user:
return

if message.content.startswith("$hello"):
await message.channel.send("Hello!")


client.run(os.getenv("DISCORD_TOKEN"))
4 changes: 4 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
discord.py
pip-tools
pre-commit
pytest
python-dotenv
52 changes: 52 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,71 @@ async-timeout==4.0.2
# via aiohttp
attrs==22.2.0
# via aiohttp
build==1.0.3
# via pip-tools
cfgv==3.4.0
# via pre-commit
charset-normalizer==2.1.1
# via aiohttp
click==8.1.7
# via pip-tools
discord-py==2.3.2
# via -r requirements.in
distlib==0.3.8
# via virtualenv
exceptiongroup==1.2.0
# via pytest
filelock==3.13.1
# via virtualenv
frozenlist==1.3.3
# via
# aiohttp
# aiosignal
identify==2.5.33
# via pre-commit
idna==3.4
# via yarl
iniconfig==2.0.0
# via pytest
multidict==6.0.4
# via
# aiohttp
# yarl
nodeenv==1.8.0
# via pre-commit
packaging==23.2
# via
# build
# pytest
pip-tools==7.3.0
# via -r requirements.in
platformdirs==4.1.0
# via virtualenv
pluggy==1.3.0
# via pytest
pre-commit==3.6.0
# via -r requirements.in
pyproject-hooks==1.0.0
# via build
pytest==7.4.4
# via -r requirements.in
python-dotenv==1.0.0
# via -r requirements.in
pyyaml==6.0.1
# via pre-commit
tomli==2.0.1
# via
# build
# pip-tools
# pyproject-hooks
# pytest
virtualenv==20.25.0
# via pre-commit
wheel==0.42.0
# via pip-tools
yarl==1.9.2
# via aiohttp

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
Binary file added spud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.