Adding dad functionality. real high level shit here
This commit is contained in:
parent
0b35a5b7c2
commit
58a399c6f6
@ -215,6 +215,14 @@ async def on_message(message):
|
|||||||
)
|
)
|
||||||
await client.send_message(message.channel, invite)
|
await client.send_message(message.channel, invite)
|
||||||
|
|
||||||
|
|
||||||
|
if message.content.lower().startswith('im') or message.content.lower().startswith('i\'m'):
|
||||||
|
subject = ' '.join(message.content.split()[1:])
|
||||||
|
await client.send_message(
|
||||||
|
message.channel,
|
||||||
|
"Hi %s, I'm dad!" % subject
|
||||||
|
)
|
||||||
|
|
||||||
if message.content.startswith('!issue'):
|
if message.content.startswith('!issue'):
|
||||||
await client.send_message(
|
await client.send_message(
|
||||||
message.channel,
|
message.channel,
|
||||||
|
67
destiny.py
Normal file
67
destiny.py
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
from datetime import date
|
||||||
|
import json
|
||||||
|
import pprint
|
||||||
|
import requests
|
||||||
|
|
||||||
|
account_name = 'Truttle%231248'
|
||||||
|
base_url = 'https://www.bungie.net/Platform/Destiny2'
|
||||||
|
headers = {'X-API-KEY': '777984975407420ba392ad951e37e406'}
|
||||||
|
pp = pprint.PrettyPrinter(indent=4)
|
||||||
|
|
||||||
|
def parse_message(message):
|
||||||
|
"""
|
||||||
|
parse_message(message)
|
||||||
|
|
||||||
|
Handles the message and looks for the player's name.
|
||||||
|
"""
|
||||||
|
# Return the player's name
|
||||||
|
name = message.content.split()[1]
|
||||||
|
if len(message.content.split()) > 1:
|
||||||
|
name = message.content.split()[1:].repalce('#', '%23')
|
||||||
|
|
||||||
|
return get_account_blob(player=name)
|
||||||
|
|
||||||
|
|
||||||
|
def get_account_blob(account_name):
|
||||||
|
initial_blob = requests.get(
|
||||||
|
"%s/SearchDestinyPlayer/-1/%s" % (base_url, account_name),
|
||||||
|
headers=headers
|
||||||
|
).json()
|
||||||
|
|
||||||
|
character_map = {}
|
||||||
|
account_metadata = initial_blob['Response'][0]
|
||||||
|
print(account_metadata)
|
||||||
|
|
||||||
|
# character_map['profile_id'] = account_metadata['membershipId']
|
||||||
|
# character_map['account_type'] = account_metadata['membershipType']
|
||||||
|
|
||||||
|
# account_url = "%s/%s/Profile/%s/?components=100" % (base_url, character_map['account_type'], character_map['profile_id'])
|
||||||
|
# account_blob = requests.get(account_url, headers=headers).json()['Response']['profile']['data']
|
||||||
|
|
||||||
|
# character_map['player_name'] = account_blob['userInfo']['displayName']
|
||||||
|
# character_map['date_last_played'] = account_blob['dateLastPlayed']
|
||||||
|
# character_map['character_ids'] = [int(x) for x in account_blob['characterIds']]
|
||||||
|
# return character_map
|
||||||
|
|
||||||
|
|
||||||
|
def get_character_info(account_type, profile_id, character_id):
|
||||||
|
character_url = "%s/%s/Profile/%s/Character/%s/?components=200" % (base_url, account_type, profile_id, character_id)
|
||||||
|
|
||||||
|
return requests.get(character_url, headers=headers).json()['Response']['character']['data']
|
||||||
|
|
||||||
|
|
||||||
|
def get_clan_info(account_type, profile_id):
|
||||||
|
group_url = "https://www.bungie.net/Platform/GroupV2/User/%s/%s/0/1/" % (account_type, str(profile_id))
|
||||||
|
print(group_url)
|
||||||
|
|
||||||
|
return requests.get(group_url, headers=headers).json()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print get_account_blob(account_name)
|
||||||
|
|
||||||
|
# account_type = get_account_blob(account_name)['account_type'],
|
||||||
|
# profile_id = get_account_blob(account_name)['profile_id'],
|
||||||
|
|
||||||
|
# pp.pprint(
|
||||||
|
# get_clan_info(account_type, profile_id)
|
||||||
|
# )
|
103
ffxiv.py
Normal file
103
ffxiv.py
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
import asyncio
|
||||||
|
import logging
|
||||||
|
import json
|
||||||
|
import pprint
|
||||||
|
|
||||||
|
import aiohttp
|
||||||
|
import xivapi
|
||||||
|
|
||||||
|
pp = pprint.PrettyPrinter(indent=4)
|
||||||
|
|
||||||
|
async def fetch_example_results(session):
|
||||||
|
client = xivapi.Client(session=session, api_key="189ab21cd81c4516b768aad19be1d0a92cf463254550463f982ac4172f138f67")
|
||||||
|
|
||||||
|
# Search Lodestone for a character
|
||||||
|
character = await client.character_search(
|
||||||
|
world="Exodus",
|
||||||
|
forename="Pizza",
|
||||||
|
surname="Rolls"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Get a character by Lodestone ID with extended data & include their Free Company information, if it has been synced.
|
||||||
|
character2 = await client.character_by_id(
|
||||||
|
lodestone_id=character['Results'][0]['ID'],
|
||||||
|
extended=True,
|
||||||
|
include_freecompany=True
|
||||||
|
)
|
||||||
|
|
||||||
|
pp.pprint(json.dumps(character2))
|
||||||
|
|
||||||
|
# # Search Lodestone for a free company
|
||||||
|
# freecompany = await client.freecompany_search(
|
||||||
|
# world="gilgamesh",
|
||||||
|
# name="Elysium"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# # Fuzzy search XIVAPI game data for a recipe by name. Results will be in English.
|
||||||
|
# recipe = await client.index_search(
|
||||||
|
# name="Crimson Cider",
|
||||||
|
# indexes=["Recipe"],
|
||||||
|
# columns=["ID", "Name", "Icon", "ItemResult.Description"],
|
||||||
|
# string_algo="fuzzy"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# # Fuzzy search XIVAPI game data for a recipe by name. Results will be in French.
|
||||||
|
# recipe = await client.index_search(
|
||||||
|
# name="Cidre carmin",
|
||||||
|
# indexes=["Recipe"],
|
||||||
|
# columns=["ID", "Name", "Icon", "ItemResult.Description"],
|
||||||
|
# string_algo="fuzzy",
|
||||||
|
# language="fr"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# # Get an item by its ID (Omega Rod) and return the data in German
|
||||||
|
# item = await client.index_by_id(
|
||||||
|
# index="Item",
|
||||||
|
# content_id=23575,
|
||||||
|
# columns=["ID", "Name", "Icon", "ItemUICategory.Name"],
|
||||||
|
# language="de"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# # Get non-npc actions matching a given term (Defiance)
|
||||||
|
# action = await client.index_search(
|
||||||
|
# name="Defiance",
|
||||||
|
# indexes=["Action", "PvPAction", "CraftAction"],
|
||||||
|
# columns=["ID", "Name", "Icon", "Description", "ClassJobCategory.Name", "ClassJobLevel", "ActionCategory.Name"],
|
||||||
|
# filters=["ClassJobLevel>=0", "ClassJobCategory.ID>0"],
|
||||||
|
# string_algo="fuzzy"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# # Search ingame data for matches against a given query. Includes item, minion, mount & achievement descriptions, quest dialog & more.
|
||||||
|
# lore = await client.lore_search(
|
||||||
|
# query="Shiva",
|
||||||
|
# language="fr"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# # Search for an item using specific filters
|
||||||
|
# filters = [
|
||||||
|
# Filter("LevelItem", "gte", 100)
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# sort = Sort("Name", True)
|
||||||
|
|
||||||
|
# item = await client.index_search(
|
||||||
|
# name="Omega Rod",
|
||||||
|
# indexes=["Item"],
|
||||||
|
# columns=["ID", "Name", "Icon", "Description", "LevelItem"],
|
||||||
|
# filters=filters,
|
||||||
|
# sort=sort,
|
||||||
|
# language="de"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# Get all categories of posts from the Lodestone (cached evert 15 minutes)
|
||||||
|
lodestone = await client.lodestone_all()
|
||||||
|
|
||||||
|
await session.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
logging.basicConfig(level=logging.INFO, format='%(message)s', datefmt='%H:%M')
|
||||||
|
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
session = aiohttp.ClientSession(loop=loop)
|
||||||
|
loop.run_until_complete(fetch_example_results(session))
|
Loading…
x
Reference in New Issue
Block a user