@@ -3,10 +3,14 @@ met-config.cfg | |||
__pycache__/metroidgen.cpython-36.pyc | |||
__pycache__/metroidgen.cpython-37.pyc | |||
metroidgen.log | |||
met-config.cfg | |||
met-config.cfg | |||
met-config.cfg | |||
sprites/1774.png | |||
sprites/1776.png | |||
sprites/1777.png | |||
sprites/122214.png | |||
pseudo.txt | |||
__pycache__/metroidgen.cpython-38.pyc | |||
sprites/bombs.png~ | |||
sprites/icebeam.png~ | |||
sprites/longbeam.png~ | |||
sprites/screwattack.png~ | |||
sprites/varia.png~ |
@@ -3,9 +3,9 @@ domain = elekk.xyz | |||
admin = noelle@elekk.xyz | |||
[metroidgen] | |||
class = metroidgen.MetroidState | |||
client_id = | |||
client_secret = | |||
access_token = | |||
class = metroidgen.MetroidPoster | |||
client_id = OTICatqOoEmldl_OhEj2QcNsmszBI1xeqy0P30IbqC4 | |||
client_secret = ClgaGBrDCV3TUOjpbSaGV4_N1Xd6867ux5TNZa08vTQ | |||
access_token = TGRKjvcbcPeFpPaNSLWwLhm2zdRwZyJaFdcHci2Zad0 | |||
admin = noelle@elekk.xyz | |||
domain = elekk.xyz | |||
domain = elekk.xyz |
@@ -836,8 +836,11 @@ class MetroidPoster(PineappleBot): | |||
post_text = gs.toString() | |||
img = self.createImage(gs.password) | |||
media_id = self.mastodon.media_post(img, description=gs.password) | |||
self.mastodon.status_post(post_text, visibility = "unlisted", spoiler_text = "Metroid password: {}".format(gs.password), media_ids = [media_id]) | |||
tootdct = self.mastodon.status_post(post_text, visibility = "unlisted", spoiler_text = "Metroid password: {}".format(gs.password), media_ids = [media_id]) | |||
print("Metroidgen scheduled: posted {}".format(gs.password)) | |||
with open("metroidgen.log", "a") as f: | |||
f.write("\n") | |||
f.write(tootdct) | |||
def createImage(self, pwd): | |||
pwd_chunks = pwd.split(" ") # This is safe because we'll never generate a password with a space in it |
@@ -833,7 +833,7 @@ class MetroidState: | |||
fnt = ImageFont.truetype('narpasfw.ttf', size=18) | |||
img = Image.new('RGB', (300, 100)) | |||
draw = ImageDraw.Draw(img) | |||
draw.text((50, 35), newpwd, font=fnt, fill=(190, 210, 255)) | |||
draw.text((50, 5), newpwd, font=fnt, fill=(190, 210, 255)) | |||
filename = 'images/{}.png'.format("".join(pwd_chunks)) | |||
img.save(filename) | |||
return filename | |||
@@ -848,11 +848,14 @@ class MetroidPoster(PineappleBot): | |||
gs.createBitfield() | |||
gs.generatePassword() | |||
post_text = gs.toString() | |||
post_text += "\n\nvalid!" | |||
img = gs.createImage() | |||
media_id = self.mastodon.media_post(img, description=gs.password) | |||
self.mastodon.status_post(post_text, visibility = "unlisted", spoiler_text = "Metroid password: {}".format(gs.password), media_ids = [media_id]) | |||
tootdct = self.mastodon.status_post(post_text, visibility = "unlisted", spoiler_text = "Metroid password: {}".format(gs.password), media_ids = [media_id]) | |||
print("Metroidgen scheduled: posted {}".format(gs.password)) | |||
with open("mgen.log", "a") as f: | |||
f.write("\n") | |||
f.write(str(tootdct)) | |||
@@ -862,6 +865,7 @@ def main(): | |||
gs.createBitfield() | |||
gs.generatePassword() | |||
print(gs.toString()) | |||
print(gs.createImage()) | |||
if __name__ == "__main__": | |||
if len(sys.argv) == 2: |