def __init__(self, bot, config_file):
super().__init__(bot)
opener = urllib_request.build_opener()
opener.addheaders = [("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) Tnybot/1.0 Chrome/55.0")]
urllib_request.install_opener(opener)
config = configparser.RawConfigParser()
config.read(config_file)
self.base_dir = config["Images"]["dir"]
self.checksum = config["Images"]["checksum"] == "True" or False
if self.checksum:
print(
"""!!!! Warning! Using checksums to detect duplicate images.
Processing image hashes may take awhile on older CPUs.
This will save disk space, but will cause an increase in downloads on restart.
"""
)
self.channels = self.get_config_values(config, "Channels")
self.merged_channels = self.get_config_values(config, "MergedChannels") or []
self.upload_channels = self.get_config_values(config, "Upload")
if not self.bot.unit_tests: # pragma: no cover
self.bot.loop.create_task(self.background())
# self.bot.loop.create_task(self.upload())
评论列表
文章目录