Skip to content

Commit 5f068fa

Browse files
committed
modify commanders to include at least 2 colors
1 parent 2d91a15 commit 5f068fa

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async def restart_error(ctx, error):
111111

112112
@bot.command(name="commander", help="Returns a random MtG commander", pass_context=True)
113113
async def surprise_commander(ctx):
114-
card = random.choice(Jace().card().type("legendary").type("creature").execute())
114+
card = random.choice(Jace().card().type("legendary").type("creature").id_atleast("2").execute())
115115
await ctx.send(f"{card['name']} {card['scryfall_uri']}")
116116

117117

scry/request.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,18 @@ def type(self, type):
3636
self.url = f"{self.url}t:{type}+"
3737
return self
3838

39+
def id_atleast(self, id):
40+
self.url = f"{self.url}id>={id}+"
41+
return self
42+
3943
def execute(self):
4044
time.sleep(0.1)
4145
r = requests.get(self.url)
4246
return [card for card in r.json()["data"]]
4347

4448

4549
def main():
46-
r = Jace().card().type("Jace").type("legendary").cmc(5, "not").execute()
50+
r = Jace().card().type("legendary").id_atleast("5").execute()
4751
card = random.choice(r)
4852
if card["layout"] != 'normal':
4953
print(card["name"], card["scryfall_uri"])

0 commit comments

Comments
 (0)