Skip to content

Commit

Permalink
begin rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
mudkipdev committed Jul 24, 2024
1 parent c12ceda commit d95623a
Show file tree
Hide file tree
Showing 12 changed files with 583 additions and 1,170 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"ms-python.python",
"charliermarsh.ruff"
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"[python]": {
"editor.formatOnSave": true
},
"files.exclude": {
"**/__pycache__": true
}
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 mudkip
Copyright (c) 2024 mudkip

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 1 addition & 3 deletions example.env
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
DISCORD_TOKEN=Your Discord bot token.
JISHAKU_NO_UNDERSCORE=1
JISHAKU_HIDE=1
DISCORD_TOKEN=Your Discord bot token.
789 changes: 548 additions & 241 deletions poetry.lock

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
[tool.poetry]
name = "scnewsbot"
version = "1.0.3"
version = "2.0.0"
description = "A bot for the r/starcitizen Discord server."
authors = ["mudkipdev <[email protected]>"]
license = "MIT"
readme = "README.md"
packages = [
{ include = "scnewsbot" }
]
readme = ".github/README.md"
packages = [ { include = "scnewsbot" } ]

[tool.poetry.dependencies]
python = "^3.12"
discord-py = "^2.3.2"
jishaku = "^2.5.2"
python = "3.12.4"
python-dotenv = "^1.0.1"
uvloop = "^0.19.0"
hikari = { extras = ["speedups"], version = "^2.0.0.dev126" }

[tool.poetry.group.dev.dependencies]
black = "^24.3.0"
ruff = "^0.5.4"

[build-system]
requires = ["poetry-core"]
Expand Down
27 changes: 12 additions & 15 deletions scnewsbot/__main__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
import tomllib
import os
from hikari import GatewayBot, Intents
from dotenv import load_dotenv
from bot import Bot
from utils import Config


class InvalidTokenException(Exception):
pass


def main() -> None:
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
if not DISCORD_TOKEN:
raise InvalidTokenException("A Discord token was not set.")
load_dotenv()
token = os.getenv("DISCORD_TOKEN")

if not token:
print("Please set a DISCORD_TOKEN environment variable.")
exit(1)

with open("config.toml", "rb") as config_file:
config = Config(tomllib.load(config_file))
if os.name != "nt":
import uvloop
uvloop.install()

bot = Bot(config)
bot.run(DISCORD_TOKEN)
bot = GatewayBot(intents=Intents.ALL_UNPRIVILEGED, token=token)
bot.run()


if __name__ == "__main__":
load_dotenv()
main()
84 changes: 0 additions & 84 deletions scnewsbot/bot.py

This file was deleted.

Loading

0 comments on commit d95623a

Please sign in to comment.