Maselkov / Maselkov-Cogs

Collection of cogs for Red-Discordbot
MIT License
2 stars 3 forks source link

Guild information #18

Closed n1tr0-5urf3r closed 7 years ago

n1tr0-5urf3r commented 7 years ago

Command to get general information about your guild Requires a guild ID String as parameter (maybe add it to the json in future?) PS: Membership in the guild is required.

(Nevermind those "Added getIconURL" commits, i reversed them all, and sorry for pushing directly to master)

n1tr0-5urf3r commented 7 years ago

No it is the full name of the guild for the search, I guess they're unique? Referred to this endpoint: https://wiki.guildwars2.com/wiki/API:2/guild/search

StephanMa commented 7 years ago

Would really appreciate it to have this working pr merged..

Maselkov commented 7 years ago

Currently looking through it, will test before merging

n1tr0-5urf3r commented 7 years ago

I wrote the Changes requested,

Any further requested changes?

Maselkov commented 7 years ago

Embed can have a maximum of 25 fields. Maybe return only the few highest rank members? Up to you, but that's a limit. Long embeds don't look nice either.

Also, please use the new getColor(user) method recently added - though your branch isnt up to date

    color = self.getColor(user)
    data = discord.Embed(colour=color)

Look at code for some examples

n1tr0-5urf3r commented 7 years ago

Updated my branch and replaced my color functions with getColor For now I think it's best to just display the first 25 Members of the guild, maybe we can change it later to be sorted by ranks. Could be different because guilds name their ranks different

Maselkov commented 7 years ago

What about guild/:id/ranks endpoint? The "order" seems to be the same as in game, as in higher order rank has power over lower order ranks

n1tr0-5urf3r commented 7 years ago

For now I got order and rank assigned to its member Any idea how to store it properly and sort it by order? Im overcomplicating it at the moment

Maselkov commented 7 years ago

For example, try to get 11 members from order: 1, and if you dont get 11, get from order 2 and so on until you reach 11. Could use a while loop.

If that's what you mean

n1tr0-5urf3r commented 7 years ago

I want to save all members in a list? array? dict? So that it looks like order1 member1 rank1 order2 member2 rank2

afterwards i can sort by order and print the first X members, but I cant figure out, how to store the data probably, tried it already with a dictionnary Also with this method I don't have to check how much ranks exists

Maselkov commented 7 years ago

Keep in mind dictionaries in python are unordered. You can use a list of dictionaries however

[
{Order: 1, Name: "Something", Rank: "Leader"}
{Order: 2, Name: "Whatever", Rank: "Officer"}
]

Lists are ordered though. But I'm not exactly sure what you want

n1tr0-5urf3r commented 7 years ago

I finally got it working now, not as I intended to do, but it works Going through every order in ranks For every order the guild has, look up the members and add the associated member to embed increment order_id +1 repeat

Is it fine now?

Maselkov commented 7 years ago

Just testing it right now, everything seems fine. But I can't really test bigger guilds yet.