iShotaBot/defs/glover.py

39 lines
1.3 KiB
Python
Raw Normal View History

2021-11-28 14:55:10 +00:00
from configparser import RawConfigParser
from typing import Union
from distutils.util import strtobool
2022-10-02 15:14:06 +00:00
# [pyrogram]
api_id: int = 0
api_hash: str = ""
2021-11-28 14:55:10 +00:00
# [Basic]
ipv6: Union[bool, str] = "False"
2022-10-02 16:34:28 +00:00
# [twitter]
consumer_key: str = ""
consumer_secret: str = ""
access_token_key: str = ""
access_token_secret: str = ""
2022-10-05 15:15:35 +00:00
# [post]
admin: int = 0
lofter_channel: int = 0
lofter_channel_username: str = ""
2022-10-13 14:36:43 +00:00
# [api]
amap_key: str = ""
2022-10-02 16:34:28 +00:00
2021-11-28 14:55:10 +00:00
config = RawConfigParser()
config.read("config.ini")
2022-10-02 15:14:06 +00:00
api_id = config.getint("pyrogram", "api_id", fallback=api_id)
api_hash = config.get("pyrogram", "api_hash", fallback=api_hash)
2021-11-28 14:55:10 +00:00
ipv6 = config.get("basic", "ipv6", fallback=ipv6)
2022-10-02 16:34:28 +00:00
consumer_key = config.get("twitter", "consumer_key", fallback=consumer_key)
consumer_secret = config.get("twitter", "consumer_secret", fallback=consumer_secret)
access_token_key = config.get("twitter", "access_token_key", fallback=access_token_key)
access_token_secret = config.get("twitter", "access_token_secret", fallback=access_token_secret)
2022-10-05 15:15:35 +00:00
admin = config.getint("post", "admin", fallback=admin)
lofter_channel = config.getint("post", "lofter_channel", fallback=lofter_channel)
lofter_channel_username = config.get("post", "lofter_channel_username", fallback=lofter_channel_username)
2022-10-13 14:36:43 +00:00
amap_key = config.get("api", "amap_key", fallback=amap_key)
2021-11-28 14:55:10 +00:00
try:
ipv6 = strtobool(ipv6)
except ValueError:
ipv6 = False