ljfbot/lgfbot.py

55 lines
26 KiB
Python
Raw Normal View History

#!/usr/bin/env python
2022-11-23 00:55:53 -08:00
import random
from getpass import getpass
2022-11-23 00:55:53 -08:00
from mastodon import Mastodon
import os
if not os.path.exists('./.lgfbot/'):
2022-11-23 00:55:53 -08:00
os.mkdir('./.lgfbot')
if not os.path.exists('./.lgfbot/lgf_client.secret'):
2022-11-23 00:55:53 -08:00
instance = input('Please enter your instance: ')
if instance[:4] != 'http':
2022-11-23 00:55:53 -08:00
instance = 'https://' + instance
Mastodon.create_app('Hourly lgf', api_base_url = instance, to_file = './.lgfbot/lgf_client.secret')
mastodon = Mastodon(
client_id = './.lgfbot/lgf_client.secret',
)
if not os.path.exists('./.lgfbot/lgf_user.secret'):
2022-11-23 00:55:53 -08:00
print('To post, lgfbot needs to generate an access token')
username = input('Enter your username: ')
password = getpass('Enter your password: ')
2022-11-23 00:55:53 -08:00
mastodon.log_in(username=username, password=password, scopes=['write:statuses'], to_file='./.lgfbot/lgf_user.secret')
mastodon = Mastodon(
access_token = './.lgfbot/lgf_user.secret'
)
verbs = ['abide', 'accelerate', 'accept', 'accomplish', 'achieve', 'acquire', 'acted', 'activate', 'adapt', 'add', 'address', 'administer', 'admire', 'admit', 'adopt', 'advise', 'afford', 'agree', 'alert', 'alight', 'allow', 'altered', 'amuse', 'analyze', 'announce', 'annoy', 'answer', 'anticipate', 'apologize', 'appear', 'applaud', 'applied', 'appoint', 'appraise', 'appreciate', 'approve', 'arbitrate', 'argue', 'arise', 'arrange', 'arrest', 'arrive', 'ascertain', 'ask', 'assemble', 'assess', 'assist', 'assure', 'attach', 'attack', 'attain', 'attempt', 'attend', 'attract', 'audited', 'avoid', 'awake', 'back', 'bake', 'balance', 'ban', 'bang', 'bare', 'bat', 'bathe', 'battle', 'beam', 'bear', 'beat', 'beg', 'begin', 'behave', 'behold', 'belong', 'bend', 'beset', 'bet', 'bid', 'bind', 'bite', 'bleach', 'bleed', 'bless', 'blind', 'blink', 'blot', 'blow', 'blush', 'boast', 'boil', 'bolt', 'bomb', 'book', 'bore', 'borrow', 'bounce', 'bow', 'box', 'brake', 'branch', 'break', 'breathe', 'breed', 'brief', 'bring', 'broadcast', 'bruise', 'brush', 'bubble', 'budget', 'build', 'bump', 'burn', 'burst', 'bury', 'bust', 'buy', 'buze', 'calculate', 'call', 'camp', 'care', 'carry', 'carve', 'cast', 'catalog', 'catch', 'cause', 'challenge', 'change', 'charge', 'chart', 'chase', 'cheat', 'check', 'cheer', 'chew', 'choke', 'choose', 'chop', 'claim', 'clap', 'clarify', 'classify', 'clean', 'clear', 'cling', 'clip', 'close', 'clothe', 'coach', 'coil', 'collect', 'color', 'comb', 'come', 'command', 'communicate', 'compare', 'compete', 'compile', 'complain', 'complete', 'compose', 'compute', 'conceive', 'concentrate', 'conceptualize', 'concern', 'conclude', 'conduct', 'confess', 'confront', 'confuse', 'connect', 'conserve', 'consider', 'consist', 'consolidate', 'construct', 'consult', 'contain', 'continue', 'contract', 'control', 'convert', 'coordinate', 'copy', 'correct', 'correlate', 'cost', 'cough', 'counsel', 'count', 'cover', 'crack', 'crash', 'crawl', 'create', 'creep', 'critique', 'cross', 'crush', 'cry', 'cure', 'curl', 'curve', 'cut', 'cycle', 'dam', 'damage', 'dance', 'dare', 'deal', 'decay', 'deceive', 'decide', 'decorate', 'define', 'delay', 'delegate', 'delight', 'deliver', 'demonstrate', 'depend', 'describe', 'desert', 'deserve', 'design', 'destroy', 'detail', 'detect', 'determine', 'develop', 'devise', 'diagnose', 'dig', 'direct', 'disagree', 'disappear', 'disapprove', 'disarm', 'discover', 'dislike', 'dispense', 'display', 'disprove', 'dissect', 'distribute', 'dive', 'divert', 'divide', 'do', 'double', 'doubt', 'draft', 'drag', 'drain', 'dramatize', 'draw', 'dream', 'dress', 'drink', 'drip', 'drive', 'drop', 'drown', 'drum', 'dry', 'dust', 'dwell', 'earn', 'eat', 'edited', 'educate', 'eliminate', 'embarrass', 'employ', 'empty', 'enacted', 'encourage', 'end', 'endure', 'enforce', 'engineer', 'enhance', 'enjoy', 'enlist', 'ensure', 'enter', 'entertain', 'escape', 'establish', 'estimate', 'evaluate', 'examine', 'exceed', 'excite', 'excuse', 'execute', 'exercise', 'exhibit', 'exist', 'expand', 'expect', 'expedite', 'experiment', 'explain', 'explode', 'express', 'extend', 'extract', 'face', 'facilitate', 'fade', 'fail', 'fancy', 'fasten', 'fax', 'fear', 'feed', 'feel', 'fence', 'fetch', 'fight', 'file', 'fill', 'film', 'finalize', 'finance', 'find', 'fire', 'fit', 'fix', 'flap', 'flash', 'flee', 'fling', 'float', 'flood', 'flow', 'flower', 'fly', 'fold', 'follow', 'fool', 'forbid', 'force', 'forecast', 'forego', 'foresee', 'foretell', 'forget', 'forgive', 'form', 'formulate', 'forsake', 'frame', 'freeze', 'frighten', 'fry', 'gather', 'gaze', 'generate', 'get', 'give', 'glow', 'glue', 'go', 'govern', 'grab', 'graduate', 'grate', 'grease', 'greet', 'grin', 'grind', 'grip', 'groan', 'grow', 'guarantee', 'guard', 'guess', 'guide', 'hammer', 'hand', 'handle', 'handwrite', 'hang', 'happen', 'harass', 'harm', 'hate', 'haunt', 'head', 'heal', 'heap', 'hear', 'heat', 'help', 'hide', 'hit', 'hold', 'hook', 'hop', 'hope', 'hover', 'hug', 'hum', 'hunt', 'hurry', 'hurt', 'hypothesize', 'identify', 'ignore', 'illustrate', 'imagine', 'implement',
adjectives = ['abandoned', 'able', 'absolute', 'adorable', 'adventurous', 'academic', 'acceptable', 'acclaimed', 'accomplished', 'accurate', 'aching', 'acidic', 'acrobatic', 'active', 'actual', 'adept', 'admirable', 'admired', 'adolescent', 'adorable', 'adored', 'advanced', 'afraid', 'affectionate', 'aged', 'aggravating', 'aggressive', 'agile', 'agitated', 'agonizing', 'agreeable', 'ajar', 'alarmed', 'alarming', 'alert', 'alienated', 'alive', 'all', 'altruistic', 'amazing', 'ambitious', 'ample', 'amused', 'amusing', 'anchored', 'ancient', 'angelic', 'angry', 'anguished', 'animated', 'annual', 'another', 'antique', 'anxious', 'any', 'apprehensive', 'appropriate', 'apt', 'arctic', 'arid', 'aromatic', 'artistic', 'ashamed', 'assured', 'astonishing', 'athletic', 'attached', 'attentive', 'attractive', 'austere', 'authentic', 'authorized', 'automatic', 'avaricious', 'average', 'aware', 'awesome', 'awful', 'awkward', 'babyish', 'bad', 'back', 'baggy', 'bare', 'barren', 'basic', 'beautiful', 'belated', 'beloved', 'beneficial', 'better', 'best', 'bewitched', 'big', 'big-hearted', 'biodegradable', 'bite-sized', 'bitter', 'black', 'black-and-white', 'bland', 'blank', 'blaring', 'bleak', 'blind', 'blissful', 'blond', 'blue', 'blushing', 'bogus', 'boiling', 'bold', 'bony', 'boring', 'bossy', 'both', 'bouncy', 'bountiful', 'bowed', 'brave', 'breakable', 'brief', 'bright', 'brilliant', 'brisk', 'broken', 'bronze', 'brown', 'bruised', 'bubbly', 'bulky', 'bumpy', 'buoyant', 'burdensome', 'burly', 'bustling', 'busy', 'buttery', 'buzzing', 'calculating', 'calm', 'candid', 'canine', 'capital', 'carefree', 'careful', 'careless', 'caring', 'cautious', 'cavernous', 'celebrated', 'charming', 'cheap', 'cheerful', 'cheery', 'chief', 'chilly', 'chubby', 'circular', 'classic', 'clean', 'clear', 'clear-cut', 'clever', 'close', 'closed', 'cloudy', 'clueless', 'clumsy', 'cluttered', 'coarse', 'cold', 'colorful', 'colorless', 'colossal', 'comfortable', 'common', 'compassionate', 'competent', 'complete', 'complex', 'complicated', 'composed', 'concerned', 'concrete', 'confused', 'conscious', 'considerate', 'constant', 'content', 'conventional', 'cooked', 'cool', 'cooperative', 'coordinated', 'corny', 'corrupt', 'costly', 'courageous', 'courteous', 'crafty', 'crazy', 'creamy', 'creative', 'creepy', 'criminal', 'crisp', 'critical', 'crooked', 'crowded', 'cruel', 'crushing', 'cuddly', 'cultivated', 'cultured', 'cumbersome', 'curly', 'curvy', 'cute', 'cylindrical', 'damaged', 'damp', 'dangerous', 'dapper', 'daring', 'darling', 'dark', 'dazzling', 'dead', 'deadly', 'deafening', 'dear', 'dearest', 'decent', 'decimal', 'decisive', 'deep', 'defenseless', 'defensive', 'defiant', 'deficient', 'definite', 'definitive', 'delayed', 'delectable', 'delicious', 'delightful', 'delirious', 'demanding', 'dense', 'dental', 'dependable', 'dependent', 'descriptive', 'deserted', 'detailed', 'determined', 'devoted', 'different', 'difficult', 'digital', 'diligent', 'dim', 'dimpled', 'dimwitted', 'direct', 'disastrous', 'discrete', 'disfigured', 'disgusting', 'disloyal', 'dismal', 'distant', 'downright', 'dreary', 'dirty', 'disguised', 'dishonest', 'dismal', 'distant', 'distinct', 'distorted', 'dizzy', 'dopey', 'doting', 'double', 'downright', 'drab', 'drafty', 'dramatic', 'dreary', 'droopy', 'dry', 'dual', 'dull', 'dutiful', 'each', 'eager', 'earnest', 'early', 'easy', 'easy-going', 'ecstatic', 'edible', 'educated', 'elaborate', 'elastic', 'elated', 'elderly', 'electric', 'elegant', 'elementary', 'elliptical', 'embarrassed', 'embellished', 'eminent', 'emotional', 'empty', 'enchanted', 'enchanting', 'energetic', 'enlightened', 'enormous', 'enraged', 'entire', 'envious', 'equal', 'equatorial', 'essential', 'esteemed', 'ethical', 'euphoric', 'even', 'evergreen', 'everlasting', 'every', 'evil', 'exalted', 'excellent', 'exemplary', 'exhausted', 'excitable', 'excited', 'exciting', 'exotic', 'expensive', 'experienced', 'expert', 'extraneous', 'extroverted', 'extra-large', 'extra-small', 'fabulous', 'failing', 'faint', 'fair', 'faithful', 'fake', 'false', 'familiar', 'famous', 'fancy',
postform = random.choice((
'{adjective} {gender} who {verb}',
'{adjective} {gender}',
'{gender} who {verb}',
))
gender = random.choice(('lgf', 'lbf', 'elf'))
2022-11-23 00:55:53 -08:00
verb = random.choice(verbs)
if verb[-2:] == 'ed' and verb[-3] not in {'a', 'e', 'i', 'o', 'u'}:
verb = verb[:-2]
if verb[-1] in {'a', 'i', 'o', 'u'}:
2022-11-23 00:55:53 -08:00
verb = verb + 'es'
elif verb[-1] in {'s', 'x'} or verb[-2] in ['s', 'x'] or verb[-2:] == 'ch':
2022-11-23 00:55:53 -08:00
verb = verb + 'es'
elif verb[-1] == 'y' and verb[-2] not in {'a', 'e', 'i', 'o', 'u'}:
2022-11-23 00:55:53 -08:00
verb = verb[:-1] + 'ies'
else:
verb = verb + 's'
adjective = random.choice(adjectives)
content = postform.format(adjective=adjective, gender=gender, verb=verb)
2022-11-23 00:55:53 -08:00
print(content)
mastodon.status_post(content, visibility='unlisted')