本文整理匯總了Python中Files.getTokenList方法的典型用法代碼示例。如果您正苦於以下問題:Python Files.getTokenList方法的具體用法?Python Files.getTokenList怎麽用?Python Files.getTokenList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Files
的用法示例。
在下文中一共展示了Files.getTokenList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: handle_error
# 需要導入模塊: import Files [as 別名]
# 或者: from Files import getTokenList [as 別名]
def handle_error(self, request, client_address):
Events.getLockObject().release() #Release the lock we have on message processing
stringBuffer = io.StringIO()
traceback.print_exc(file = stringBuffer)
stringBuffer.seek(0) #Reset to start of message
errorMessage = stringBuffer.read().replace("\n","\r\n")
log.error("==== ERROR OCCURRED IN SERVER. PRINTING ERROR ====")
log.error(errorMessage) #Output the message to logging
if SEND_ERRORS_OVER_GROUPME:
sendGroup = makeNamedGroup(99, "23222092", ("27094908", Files.getTokenList()[0]))
sendGroup.setBot("3da109b71b8c3363c4b87a7e67")
sendGroup.save()
try:
if sendGroup:
log.network.statePush(False)
success = sendGroup.handler.write("\nMESSAGE FOR YOU SIR:\n" + errorMessage)
log.network.statePop()
if success:
log.error("Successful error report sent")
else:
log.error("Failed to send error report")
except Exception as e: #I don't care about any errors here. jk
raise e #Jk I do
示例2: main
# 需要導入模塊: import Files [as 別名]
# 或者: from Files import getTokenList [as 別名]
def main():
"""Initialize All Modules"""
tokenList = Files.getTokenList() #[0] should be mine, and [1] should be my alt for group creation
log.debug("Tokens:",tokenList)
#Just my user id and token
put = ("27094908", tokenList[0])
#Totally Not The NSA Token
Groups.Group.overlord = tokenList[1]
#Just things
log.network.debug.disable() #Suppress the return value of every message
#log.command.low.enable() #For going through all the commands every time we get a command
#log.user.low.enable() #For going through all the users every time we search for a user
if Events.IS_TESTING:
log.save.low.enable()
#First load all the groups
log.info("========== PRE-INIT (LOAD) ==========")
toLoadList = []
for folder in Files.getDirsInDir():
if "Group " in folder: #If it a folder containing a group to load
number = int(folder.split(" ")[-1])
obj = (number, folder,) #Tuple of number and folder name
flag = True
for i in range(len(toLoadList)): #Sort the list
if number < toLoadList[i][0]:
toLoadList.insert(i, obj)
flag = False
break
if flag: #If did not insert anywhere else
toLoadList.append(obj)
#Loadsd the groups guarenteed in order
for group in toLoadList:
Groups.loadGroup(group[1])
log.info("Groups: ", Groups.getSortedList())
#Do init and post-init
log.info("========== INIT ==========")
for group in list(Groups.getSortedList()): group.init()
### Named groups should be made after INIT to avoid duplicated initial users
testGroup = makeNamedGroup(1, "23199161", put)
toriGroup = makeNamedGroup(15, "23317842", put, "DLARulez")
groupFam = makeNamedGroup(2, "13972393", put, "easier")
groupOldRocket = makeNamedGroup(10, "26730422", put, "password")
rocketMainGroup = makeCollective(20, "33057510", put)
electronicsGroup = makeCollector(21, "33057523", put, rocketMainGroup)
designAndMGroup = makeCollector(22, "33058451", put, rocketMainGroup)
propulsionGroup = makeCollector(23, "33058488", put, rocketMainGroup)
civGroup = makeCollective(30, "36614847", put, classType = Groups.Group) #Just a collective because I'm lazy in properly naming things. Is a normal group
try: #This is so we can have our finally block remove any extra threads in case of error
log.info("========== POST-INIT ==========")
for group in list(Groups.getSortedList()):
try: group.postInit()
except AssertionError: pass
log.info("========== GROUP CLEANUP ==========")
deletionList = Groups.getSortedList()
deletionList.reverse()
for i in deletionList.copy():
if i.markedForDeletion:
log.info("Deleting group", i)
i.deleteSelf()
del i
del deletionList
#try:
def postEarlyMorningFact():
joke = Jokes.funFacts.getJoke()
if type(joke) == tuple:
return Jokes.funFacts._postJoke(groupFam, ("Oh boy 3 A.M.!\n"+joke[0], joke[1]))
return Jokes.funFacts._postJoke(groupFam, "Oh boy 3 A.M.!\n" + joke)
def updateAllMsgLists():
for searcher in MsgSearch._searcherList: #We could also probably get from all active groups instead of the searcher list
searcher.GenerateCache()
def postCivReminder():
civGroup.handler.write("Don't forget to do your civ turn!")
server = Server(('', Network.SERVER_CONNECTION_PORT), ServerHandler)
#Update things for the groups every day at 5 a.m.
#.........這裏部分代碼省略.........