Skip to content

Commit 9f50522

Browse files
committed
force format
1 parent 5f068fa commit 9f50522

2 files changed

Lines changed: 8 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").id_atleast("2").execute())
114+
card = random.choice(Jace().card().type("legendary").type("creature").id_atleast("2").format("commander").execute())
115115
await ctx.send(f"{card['name']} {card['scryfall_uri']}")
116116

117117

scry/request.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,20 @@ def id_atleast(self, id):
4040
self.url = f"{self.url}id>={id}+"
4141
return self
4242

43+
def format(self, format):
44+
self.url = f"{self.url}f:{format}+"
45+
return self
46+
4347
def execute(self):
4448
time.sleep(0.1)
4549
r = requests.get(self.url)
4650
return [card for card in r.json()["data"]]
4751

4852

4953
def main():
50-
r = Jace().card().type("legendary").id_atleast("5").execute()
54+
jace = Jace()
55+
r = jace.card().type("legendary").id_atleast("5").format("commander").execute()
56+
print(requests. jace)
5157
card = random.choice(r)
5258
if card["layout"] != 'normal':
5359
print(card["name"], card["scryfall_uri"])

0 commit comments

Comments
 (0)