Skip to content

Bot improvements #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM python:3.12.7-alpine3.20

RUN apk add --no-cache git
FROM python:3.12.10-alpine
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

COPY . ./ScalarBot

WORKDIR /ScalarBot

RUN pip install --no-cache-dir -r requirements.txt
RUN uv sync --frozen

CMD ["python", "__main__.py"]
CMD ["uv", "run", "__main__.py"]
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ Scalar Discord's server official Bot
# 📖 • Table of contents

- [📄 • Presentation](#--presentation)
- [📃 • Credits](#--credits)
- [📝 • License](#--license)

# 📄 • Presentation

This repository contains the source code of the Scalar Bot, the official bot of the Scalar Discord server.

# 📃 • Credits

- [Paul Bayfield](https://github.com/PaulBayfield)
This repository contains the source code of the Scalar Bot, the official bot of the Scalar Discord server.
The bot is designed to enhance the experience of the Scalar community by providing various features and functionalities.
The Scalar Bot is publicly available, meaning it can be used in Direct Messages, Private Groups, as well as any Discord server.
Made by [Paul Bayfield](https://github.com/PaulBayfield)

# 📝 • License

```
Copyright 2025 Scalar, Paul Bayfield
Copyright 2025 Scalar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
20 changes: 13 additions & 7 deletions ScalarBot/cogs/Commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Commands(commands.Cog):
"""
Commandes du bot.
Bot commands for the Scalar bot.
"""
def __init__(self, client: commands.Bot):
self.client = client
Expand Down Expand Up @@ -34,26 +34,32 @@ async def scalar(
icon_url=self.client.user.avatar.url,
)

website = discord.ui.Button(
button_website = discord.ui.Button(
style=discord.ButtonStyle.link,
label="Website",
url="https://scalar.com",
)
docs = discord.ui.Button(
button_docs = discord.ui.Button(
style=discord.ButtonStyle.link,
label="Documentation",
url="https://guides.scalar.com",
)
github = discord.ui.Button(
button_github = discord.ui.Button(
style=discord.ButtonStyle.link,
label="Github",
url="https://github.com/scalar/scalar",
)
button_discord = discord.ui.Button(
style=discord.ButtonStyle.link,
label="Discord",
url=self.client.config.discord_invite,
)

view = discord.ui.View()
view.add_item(website)
view.add_item(docs)
view.add_item(github)
view.add_item(button_website)
view.add_item(button_docs)
view.add_item(button_github)
view.add_item(button_discord)

await interaction.response.send_message(
embed=embed,
Expand Down
2 changes: 1 addition & 1 deletion ScalarBot/cogs/Events.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Events(commands.Cog):
def __init__(self, client: discord.Client):
self.client = client


@commands.Cog.listener()
async def on_message(self, message: discord.Message):
if message.author.bot or message.guild is None or message.author.id == self.client.user.id or message.content == "":
Expand Down
1 change: 1 addition & 0 deletions ScalarBot/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ def __init__(self, environ: dict):
self.channel_showcase = int(environ.get("DISCORD_CHANNEL_SHOWCASE", 0))
self.embed_colour = int(environ.get("DISCORD_EMBED_COLOUR", 0), base=16)
self.footer_text = f"© {datetime.now().year} Scalar • scalar.com"
self.discord_invite = environ.get("DISCORD_INVITE", "https://discord.gg/scalar")
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
volumes:
- discord.log:/ScalarBot/discord.log
environment:
- PYTHONUNBUFFERED=0
- PYTHONUNBUFFERED=1
- TOKEN=${TOKEN}
- DISCORD_INVITE_URL=${DISCORD_INVITE_URL}
- DISCORD_EMBED_COLOUR=${DISCORD_EMBED_COLOUR}
Expand Down
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[project]
name = "scalar-bot"
version = "1.0.0"
description = "Our Discord bot for https://discord.gg/scalar"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"aiohttp>=3.11.17",
"discord-py>=2.5.2",
"python-dotenv>=1.1.0",
]
Binary file removed requirements.txt
Binary file not shown.
416 changes: 416 additions & 0 deletions uv.lock

Large diffs are not rendered by default.