diff --git a/MTGMastodonBot.py b/MTGMastodonBot.py index b288417..703d544 100644 --- a/MTGMastodonBot.py +++ b/MTGMastodonBot.py @@ -32,14 +32,15 @@ mtg_set = card['set_name'] with open('image.jpg', 'wb') as out_file: copyfileobj(get(img_url, stream = True).raw, out_file) +# Removing weird or unusable characters for hashtags +special_characters=["$", "'","`","%","&","(",")",",",":","?","!","@",",",".","*"] +for i in special_characters: + hTitle = mtg_title.replace(i,"") + hSet = mtg_set.replace(i,"") + hArtist = mtg_artist.replace(i,"") + # Set the Mastodon post information -media = mastodon.media_post("image.jpg","size:'372x520'", description="Card Name: " + mtg_title + "\n" + "Set: " + mtg_set + "\n" + "Description: " + flavor + "\n" + "Artist: " + mtg_artist) +media = mastodon.media_post("image.jpg", description="Card Name: " + mtg_title + "\n" + "Set: " + mtg_set + "\n" + "Description: " + flavor + "\n" + "Artist: " + mtg_artist) -# Print Text -print (mtg_title) -print (mtg_set) -print (img_url) -print (flavor) - - -mastodon.status_post("#magicthegathering" + " " + "#mtg" + " " + "#" + mtg_title.replace(" ", "") + " " + "#" + mtg_set.replace(" ","") + " " + "#" + mtg_artist.replace(" ",""),media_ids=media) +# Post the Toot +mastodon.status_post("#magicthegathering" + " " + "#mtg" + " " + "#" + hTitle.replace(" ", "") + " " + "#" + hSet.replace(" ", "") + " " + "#" + hArtist.replace(" ", ""),media_ids=media) diff --git a/image.jpg b/image.jpg new file mode 100644 index 0000000..48774c6 Binary files /dev/null and b/image.jpg differ