Skip to content

Commit 0490111

Browse files
committedSep 24, 2023
Migrated to setup.cfg
And updated user-agent string with version
1 parent d68345c commit 0490111

File tree

6 files changed

+44
-22
lines changed

6 files changed

+44
-22
lines changed
 

‎setup.cfg

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[metadata]
2+
name = drbot
3+
version = attr: drbot.__version__
4+
author = c0d3rman
5+
description = DrBot - A modular Reddit bot to cure your moderation woes.
6+
long_description = file: README.md
7+
long_description_content_type = text/markdown
8+
license = CC BY-SA 4.0
9+
license_files = LICENSE
10+
url = https://github.com/c0d3rman/DrBot
11+
classifiers =
12+
Development Status :: 3 - Alpha
13+
Intended Audience :: Developers
14+
License :: Free To Use But Restricted
15+
Natural Language :: English
16+
Programming Language :: Python
17+
Programming Language :: Python :: 3
18+
Programming Language :: Python :: 3 :: Only
19+
Topic :: Communications
20+
Typing :: Typed
21+
22+
[options]
23+
package_dir=
24+
=src
25+
packages=find:
26+
install_requires =
27+
praw
28+
prawcore
29+
schedule
30+
tomlkit
31+
32+
[options.packages.find]
33+
where=src

‎setup.py

+2-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
from setuptools import setup, find_packages
1+
import setuptools
22

3-
with open("README.md", "r") as fh:
4-
long_description = fh.read()
5-
6-
setup(
7-
name='drbot',
8-
version='2.0.0',
9-
description='DrBot - A modular Reddit bot to cure your moderation woes.',
10-
long_description=long_description,
11-
long_description_content_type='text/markdown',
12-
url='https://github.com/c0d3rman/DRBOT',
13-
author='c0d3rman',
14-
license='CC BY-SA 4.0',
15-
package_dir={"": "src"},
16-
packages=find_packages(where="src"),
17-
install_requires=["praw", "prawcore", "schedule", "tomlkit"],
18-
)
3+
setuptools.setup()

‎src/drbot/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
__version__ = "2.0.0"
2+
__version_info__ = tuple(int(i) for i in __version__.split(".") if i.isdigit())
3+
14
from .settings import settings
25
from .log import log
36
from .reddit import reddit
47
from . import util
58
from .DrBot import DrBot
69

7-
__all__ = ["settings", "log", "reddit", "util", "DrBot"]
10+
__all__ = ("settings", "log", "reddit", "util", "DrBot")

‎src/drbot/botlings/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from ..Botling import Botling
22
from .ModmailLinker import ModmailLinker
33

4-
__all__ = ["Botling", "ModmailLinker"]
4+
__all__ = ("Botling", "ModmailLinker")

‎src/drbot/reddit.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from uuid import uuid4
66
import praw
77
import prawcore
8+
from drbot import __version__
89
from .settings import settings
910
from .log import log, ModmailLoggingHandler, TemplateLoggingFormatter, BASE_FORMAT
1011
from .util import Singleton
@@ -142,14 +143,14 @@ def is_mod(self, username: str | praw.reddit.models.Redditor) -> bool:
142143
reddit = DrReddit(client_id=settings.reddit_auth.drbot_client_id,
143144
client_secret=None,
144145
refresh_token=settings.reddit_auth._refresh_token,
145-
user_agent="DrBot")
146+
user_agent=f"DrBot v{__version__}")
146147
elif settings.reddit_auth.manual._username != "":
147148
log.debug(f"Logging in to reddit using username + password + client_secret... (client id '{settings.reddit_auth.drbot_client_id}')")
148149
reddit = DrReddit(client_id=settings.reddit_auth.drbot_client_id,
149150
client_secret=settings.reddit_auth.manual._client_secret,
150151
username=settings.reddit_auth.manual._username,
151152
password=settings.reddit_auth.manual._password,
152-
user_agent=f"DrBot")
153+
user_agent=f"DrBot v{__version__}")
153154
else:
154155
e = RuntimeError("You need to set a login method in settings/secrets.toml!")
155156
log.critical(e)

‎src/drbot/streams/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
from .CommentStream import CommentStream
66
from .ModlogStream import ModlogStream
77

8-
__all__ = ["Stream", "SubStream", "ModmailStream", "PostStream", "CommentStream", "ModlogStream"]
8+
__all__ = ("Stream", "SubStream", "ModmailStream", "PostStream", "CommentStream", "ModlogStream")

0 commit comments

Comments
 (0)
Please sign in to comment.