WaifuWars.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Shallus-Bot 作者: cgropp 项目源码 文件源码
def __init__(self, bot):
        self.bot = bot
        self.waifu1votes = 0
        self.waifu2votes = 0
        self.startTime = 0
        self.duration = 120

        #Initialize empty set for users that have already voted
        self.alreadyVoted = set({})
        #Initialize empty list for channels to announce winners to
        self.channels = set({})

        #Login stuff from Safebooru
        parser = configparser.ConfigParser()
        parser.read('data/auth/auth.ini')
        self.has_login = False
        if not parser.has_section("Safebooru Login"):
            self.session = aiohttp.ClientSession()
            print("No Safebooru credentials provided; api calls will be anonymous")
        else:
            self.loginName = parser['Safebooru Login']['Username']
            self.loginToken = parser['Safebooru Login']['Token']
            if self.loginName != "" and self.loginToken != "":
                self.session = aiohttp.ClientSession(auth=aiohttp.BasicAuth(self.loginName, self.loginToken))
                self.has_login = True
            else:
                self.session = aiohttp.ClientSession()
            atexit.register(self.closeConnection)


    #Starts the waifu war
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号