def runner(self): eve = evelink.eve.EVE() for toon in self.characters: if toon.cachetimer > arrow.utcnow().timestamp: #print('{} not ready yet: {} left'.format(toon.name, toon.cachetimer - arrow.utcnow().timestamp)) continue api = evelink.api.API(api_key=(toon.keyid, toon.vcode)) id = eve.character_id_from_name(toon.name) char = evelink.char.Char(char_id=id, api=api) notes = char.notifications() toon.cachetimer = notes.expires for notificationID in notes[0]: timesent = notes[0][notificationID]['timestamp'] timesent = datetime.datetime.fromtimestamp(timesent) now = datetime.datetime.now() if timesent > now-datetime.timedelta(minutes=30): sendme = self.noteid().get(int(notes[0][notificationID]['type_id']), '') if sendme: sendme(notificationID, toon)
def fweight(name): if name: eve = evelink.eve.EVE() id = eve.character_id_from_name(name) if not id.result: return "Character not found" contracts, timer = get_contracts() outstanding, completed, inprogress, volume = get_user_contracts( id.result, contracts) return '```Fweight Status for {} for the last 30 days\nOutstanding: {}\nInProgress: {}\nCompleted: {}\nOutstanding Volume: {}\nNew data {}```'.format( name, outstanding, inprogress, completed, volume, arrow.get(timer).humanize()) else: # Get Fweight totals if no name supplied contracts, timer = get_contracts() outstanding, completed, inprogress, volume = get_total_contracts( contracts) return '```Fweight Totals (no name given) for the last 30 days\nOutstanding: {}\nInProgress: {}\nCompleted: {}\nOutstanding Volume: {}\nNew data {}```'.\ format(outstanding, inprogress, completed, volume, arrow.get(timer).humanize())
def gettext(self,notificationid, toon): api = evelink.api.API(api_key=(toon.keyid, toon.vcode)) eve = evelink.eve.EVE() id = eve.character_id_from_name(toon.name) char = evelink.char.Char(char_id=id, api=api) notes = char.notification_texts(notification_ids=(notificationid)) return notes[0]
def grabnotes(self, toon): eve = evelink.eve.EVE() # for toon in self.characters.getall(): # api = evelink.api.API(api_key=(toon.keyid, toon.vcode)) # id = eve.character_id_from_name(toon.name) # char = evelink.char.Char(char_id=id, api=api) # # notes = char.notifications() # # #ccp recently changed how the api caches info, giving a hard time instead of pushing back everytime we call # toon.apicachetime = int(notes.expires) # # messages = [] # # for notificationID in notes[0]: # now = datetime.datetime.now() # # timesent = notes[0][notificationID]['timestamp'] # #timesent = datetime.datetime.strptime(timesent,'%Y-%m-%d %H:%M:%S') # timesent = datetime.datetime.fromtimestamp(timesent) # #print timesent, now-datetime.timedelta(minutes=60) # if timesent > now-datetime.timedelta(minutes=30): # sendme = self.noteid().get(notes[0][notificationID]['type_id'], '') # if sendme: # message = sendme(notificationID, toon) # self.lastnotification = message # #self.send_message(mto=mess['from'].bare, mbody=message, mtype='groupchat') # messages.append(message) # return messages api = evelink.api.API(api_key=(toon.keyid, toon.vcode)) id = eve.character_id_from_name(toon.name) char = evelink.char.Char(char_id=id, api=api) notes = char.notifications() toon.apicachetime = notes.expires messages = [] for notificationID in notes[0]: timesent = notes[0][notificationID]['timestamp'] timesent = datetime.datetime.fromtimestamp(timesent) now = datetime.datetime.now() if timesent > now-datetime.timedelta(minutes=30): sendme = self.noteid().get(notes[0][notificationID]['type_id'], '') if sendme: message = sendme(notificationID, toon) messages.append(message) return messages
def fweight(name): if name: eve = evelink.eve.EVE() id = eve.character_id_from_name(name) if not id.result: return "Character not found" contracts, timer = get_contracts() outstanding, completed, inprogress = get_user_contracts(id.result, contracts) return '```Fweight Status for {} for the last 30 days\nOutstanding: {}\nInProgress: {}\nCompleted: {}\nNew data {}```'.format( name, outstanding, inprogress, completed, arrow.get(timer).humanize()) else: # Get Fweight totals if no name supplied contracts, timer = get_contracts() outstanding, completed, inprogress = get_total_contracts(contracts) return '```Fweight Totals (no name given) for the last 30 days\nOutstanding: {}\nInProgress: {}\nCompleted: {}\nNew data {}```'.\ format(outstanding, inprogress, completed, arrow.get(timer).humanize())