def __init__(self): self.guilds = {} self.waifus = {} if path.exists("guilds.json"): with open('guilds.json', 'r') as f: tmp_guilds = json.load(f) for key in tmp_guilds: t_id = key t_prefix = "cb." t_emoji = default_emoji t_mute_role = -1 t_tmp_category = -1 if "id" in tmp_guilds[key]: t_id = tmp_guilds[key]["id"] if "prefix" in tmp_guilds[key]: t_prefix = tmp_guilds[key]["prefix"] if "emoji" in tmp_guilds[key]: t_emoji = tmp_guilds[key]["emoji"] if "mute_role" in tmp_guilds[key]: t_mute_role = int(tmp_guilds[key]["mute_role"]) if "tmp_category" in tmp_guilds[key]: t_tmp_category = int(tmp_guilds[key]["tmp_category"]) self.guilds[int(key)] = Guild(t_id, t_prefix, t_emoji, t_mute_role, t_tmp_category) print(int(key), self.guilds[int(key)].id, self.guilds[int(key)].prefix, self.guilds[int(key)].emoji, self.guilds[int(key)].mute_role, self.guilds[int(key)].tmp_category) try: r_waifus = requests.get("http://localhost:3000/api/waifus") r_series = requests.get("http://localhost:3000/api/series") tmp_series = {} if r_series.status_code == 200: series_json = r_series.json() for obj in series_json: tmp_series[obj["_id"]] = obj["nombre"] if r_waifus.status_code == 200: waifus_json = r_waifus.json() for waifu in waifus_json: self.waifus[waifu["nombre"]] = WaifuData( waifu["nombre"], tmp_series[waifu["serie_id"]], waifu["image_url"]) else: print("error al solicitar series: " + r_series.status_code) except: print("error al solicitar al api") for a in self.waifus: print(a)
def main(): KEY = Setter.set_api_key('REPLACE WITH YOUR KEY') player = Player.get_player_info('RapidTheNerd') print(player) level = Player.find_level('RapidTheNerd') print(level) rank = Player.get_rank('RapidTheNerd') guild = Guild.get_guild_members('GUILD ID')
def get_guild_list(self,headers,base_url): guild_response = requests.get(url = (base_url+"/guilds"),headers = headers) guild_json = guild_response.json() owned_guild_list = [] ''' iterate through all the guilds if admin, manage guild or owner, add to list ''' for guild in guild_json: permission = Permissions(guild['permissions'])#create permission object if((guild["owner"] == True)or(permission.manage_guild)or(permission.administrator)): guild_object = Guild(guild) owned_guild_list.append(guild_object) return owned_guild_list
def new_guild_check(self, guild_id): if not self.check_guild(guild_id): self.guilds[guild_id] = Guild(guild_id, 'cb.', default_emoji)
async def on_message(message): if message.author == client.user: return if message.content.startswith('$hello'): await message.channel.send('potato') if message.content.startswith('$iam '): splitMessage = message.content.split('-') if len(splitMessage) < 2: await message.channel.send("you're potato, invalid command") return player = Player(message.author, splitMessage[1].strip(), splitMessage[2].strip()) db[get_user_db_key(message.author)] = player.get_user_db_value() await message.channel.send( "registered @{0} with player name {1}".format( message.author, player.name)) if message.content.startswith('$myguild '): data = message.content.split('-') guild = Guild(data[1].strip(), data[2].strip()) player = Player(message.author) player.add_guild_to_player(guild) guild.add_player_to_guild(player) if message.content.startswith('$whatsmyguild'): player = Player(message.author) player_guild = db[player.get_player_guild_key()] await message.channel.send(player_guild) if message.content.startswith('$registerguild'): data = message.content.split('-') guild = Guild(data[1].strip(), data[2].strip()) result = guild.register_guild_in_db() await message.channel.send(result) if message.content.startswith('$guilds'): matches = db.prefix("guild") await message.channel.send(matches) if message.content.startswith('$guildreports'): data = message.content.split('-') guild = Guild(data[1].strip(), data[2].strip()) result = guild.get_new_guild_reports() if (not result): await message.channel.send("couldn't find new reports dummy") else: report_id = result[0]["id"] await message.channel.send( "Analysis for {0}: https://xivanalysis.com/fflogs/{1}".format( guild.name, report_id)) if message.content.startswith('$guildmembers'): data = message.content.split('-') guild = Guild(data[1].strip(), data[2].strip()) await message.channel.send(db[guild.get_guild_members_key()])
def handle_player_test(uuid): uuid = 'should-replace-with-my-key' Guild.guid = uuid print(Guild.get_guild_members()) print(Guild.JSON)
from guild import Guild from player import Player player = Player("George", 50, 100) print(player.add_skill("Shield Break", 20)) print(player.player_info()) guild = Guild("UGT") print(guild.assign_player(player)) print(guild.guild_info())
print(highlight(pformat(obj), PythonLexer(), TerminalFormatter())) # import digitalocean from wisp import Wisp from party import Party from guild import Guild # pp = pprint.PrettyPrinter(indent=4) # manager = digitalocean.Manager(token="48f44a588d0dd1f1652a47a057e40aecc889164009d52e448a92ac1876741919") # my_droplets = manager.get_all_droplets() # print(my_droplets) guild = Guild(0) party = guild.spawn_party(0, "green_secret") # wisp = Wisp.spawn(party) party.spawn_wisp() party.spawn_wisp() party.spawn_wisp() wisp = party.wisps_list[0] # print (inspect.getmembers(wisp)) print("\nguild:") pprint_color(vars(guild)) guild.parties_printNames() print("\nparty:") print(party.guild.name) # pprint_color(vars(party))