diff --git a/futaba/cogs/optional/simplewriter/__init__.py b/futaba/cogs/optional/simplewriter/__init__.py new file mode 100644 index 00000000..855712c0 --- /dev/null +++ b/futaba/cogs/optional/simplewriter/__init__.py @@ -0,0 +1,32 @@ +# +# cogs/optional/simplewriter/__init__.py +# +# futaba - A Discord Mod bot for the Programming server +# Copyright (c) 2017-2020 Jake Richardson, Ammon Smith, jackylam5 +# +# futaba is available free of charge under the terms of the MIT +# License. You are free to redistribute and/or modify it under those +# terms. It is distributed in the hopes that it will be useful, but +# WITHOUT ANY WARRANTY. See the LICENSE file for more details. +# + +from .core import SimplewriterCog + + +def setup(bot): + setup_simplewriter(bot) + + +def setup_simplewriter(bot): + cog = SimplewriterCog(bot) + bot.add_listener(cog.on_message, "on_message") + bot.add_listener(cog.on_message_edit, "on_message_edit") + bot.add_cog(cog) + + +def teardown(bot): + teardown_simplewriter(bot) + + +def teardown_simplewriter(bot): + bot.remove_cog(SimplewriterCog.__name__) diff --git a/futaba/cogs/optional/simplewriter/core.py b/futaba/cogs/optional/simplewriter/core.py new file mode 100644 index 00000000..d8d61daa --- /dev/null +++ b/futaba/cogs/optional/simplewriter/core.py @@ -0,0 +1,45 @@ +# +# cogs/optional/simplewriter/core.py +# +# futaba - A Discord Mod bot for the Programming server +# Copyright (c) 2017-2020 Jake Richardson, Ammon Smith, jackylam5 +# +# futaba is available free of charge under the terms of the MIT +# License. You are free to redistribute and/or modify it under those +# terms. It is distributed in the hopes that it will be useful, but +# WITHOUT ANY WARRANTY. See the LICENSE file for more details. +# + +""" +A thing that lets you write stuff in one word box, but only if it's made up of +the first ten hundred most used words of the language. + +(https://xkcd.com/simplewriter) +""" + +from futaba.cogs.abc import AbstractCog + +from .simple_filter import simple_filter + + +class SimplewriterCog(AbstractCog): + __slots__ = ("journal", "channel_id") + + def __init__(self, bot): + super().__init__(bot) + self.journal = bot.get_broadcaster("/simplewriter") + self.channel_id = int(bot.config.optional_cogs["simplewriter"]["channel-id"]) + + def setup(self): + pass + + def cog_unload(self): + self.bot.remove_listener(self.on_message, "on_message") + self.bot.remove_listener(self.on_message_edit, "on_message_edit") + + async def on_message(self, message): + await simple_filter(self, message) + + async def on_message_edit(self, before, after): + if after: + await simple_filter(self, after) diff --git a/futaba/cogs/optional/simplewriter/simple_filter.py b/futaba/cogs/optional/simplewriter/simple_filter.py new file mode 100644 index 00000000..f4573551 --- /dev/null +++ b/futaba/cogs/optional/simplewriter/simple_filter.py @@ -0,0 +1,110 @@ +# +# cogs/optional/simplewriter/simple_filter.py +# +# futaba - A Discord Mod bot for the Programming server +# Copyright (c) 2017-2020 Jake Richardson, Ammon Smith, jackylam5 +# +# futaba is available free of charge under the terms of the MIT +# License. You are free to redistribute and/or modify it under those +# terms. It is distributed in the hopes that it will be useful, but +# WITHOUT ANY WARRANTY. See the LICENSE file for more details. +# + +""" +Filters messages through the allowed wordlist, deleting unallowed words. +""" + +import logging +import re +from datetime import datetime + +import discord +from discord import MessageType + +from futaba.utils import plural + +from .words import core_words_list + +logger = logging.getLogger(__name__) +REGEX_SPLIT = r"[^a-zA-Z0-9_']" + +__all__ = ["simple_filter"] + + +async def simple_filter(cog, message): + """ + Filter Discord messages for the simplewriter channel + """ + + # Message is in designated channel + if message.channel.id != cog.channel_id: + return + + # Don't filter bot messages + if message.author.id == cog.bot.user.id: + return + + # Not a special message type + if message.type != MessageType.default: + return + + # Make sure we actually can remove this message + if not message.channel.permissions_for(message.guild.me).manage_messages: + return + + logger.debug( + "Checking message id %d (by '%s' (%d)) against simplewriter core words list", + message.id, + message.author.name, + message.author.id, + ) + + split = re.split(REGEX_SPLIT, message.content) + bad_words = [] + for word in split: + cleaned = word.strip() + if not cleaned: + continue + if not cleaned.lower() in core_words_list: + if not cleaned in bad_words: + try: # test to see if input is a number + int(cleaned) + except ValueError: + bad_words.append(cleaned) + + if len(bad_words) > 0: + await message.delete() + + content = ( + f"Message id {message.id} (by '{message.author.name}' ({message.author.id})) filtered from " + "simplewriter channel" + ) + cog.journal.send( + "message/delete", + message.guild, + content, + icon="delete", + channel=message.channel, + message=message, + ) + + bad_words_plural = plural(len(bad_words)) + article = "some" if len(bad_words) > 1 else "a" + + help_embed = discord.Embed() + help_embed.color = discord.Color.red() + help_embed.title = f"You used {article} less simple word{bad_words_plural}." + help_embed.description = ( + f"Your message in {message.channel.mention} has been removed.\n" + "You can use [xkcd's simplewriter](https://xkcd.com/simplewriter) " + "to see what words are valid in this channel." + ) + help_embed.timestamp = datetime.now() + help_embed.add_field(name="Full message", value=message.content) + help_embed.add_field( + name=f"Bad word{bad_words_plural}", value=", ".join(bad_words) + ) + help_embed.set_footer(text=message.id) + + dm_channel = message.author.dm_channel or await message.author.create_dm() + await dm_channel.send(embed=help_embed) diff --git a/futaba/cogs/optional/simplewriter/words/__init__.py b/futaba/cogs/optional/simplewriter/words/__init__.py new file mode 100644 index 00000000..41c6233e --- /dev/null +++ b/futaba/cogs/optional/simplewriter/words/__init__.py @@ -0,0 +1,15 @@ +# +# cogs/optional/simplewriter/words/__init__.py +# +# futaba - A Discord Mod bot for the Programming server +# Copyright (c) 2017-2020 Jake Richardson, Ammon Smith, jackylam5 +# +# futaba is available free of charge under the terms of the MIT +# License. You are free to redistribute and/or modify it under those +# terms. It is distributed in the hopes that it will be useful, but +# WITHOUT ANY WARRANTY. See the LICENSE file for more details. +# + +__all__ = ["core_words_list"] + +from .words import core_words_list diff --git a/futaba/cogs/optional/simplewriter/words/core_words_list.txt b/futaba/cogs/optional/simplewriter/words/core_words_list.txt new file mode 100644 index 00000000..c03705e9 --- /dev/null +++ b/futaba/cogs/optional/simplewriter/words/core_words_list.txt @@ -0,0 +1 @@ +a,able,about,above,aboves,accept,accepted,accepting,accepts,across,act,acted,acting,actings,acts,actually,add,added,adding,adds,admit,admits,admitted,admitting,afraid,after,afternoon,afternoons,again,against,age,aged,ageing,ages,aging,ago,agree,agreed,agreeing,agrees,ahead,air,aired,airing,airings,airs,alive,all,allow,allowed,allower,allowers,allowing,allows,almost,alone,along,already,also,although,always,am,among,an,and,angrier,angriest,angry,animal,animals,another,answer,answered,answering,answers,any,anybody,anymore,anyone,anything,anyway,anyways,anywhere,apartment,apartments,appear,appeared,appearing,appears,approach,approached,approaches,approaching,are,area,areas,aren't,arm,armed,arming,arms,around,arrive,arrived,arrives,arriving,art,arts,as,ask,asked,asking,asks,asleep,at,ate,attack,attacked,attacking,attacks,attention,aunt,aunts,avoid,avoided,avoiding,avoids,away,babies,baby,back,backed,backing,backings,backs,bad,bag,bagged,bagger,baggers,bagging,bags,ball,balled,balling,balls,bank,banked,banking,bankings,banks,bar,bars,barely,bathroom,bathrooms,be,beach,beached,beaches,beaching,bear,bearing,bears,beat,beaten,beater,beaters,beating,beatings,beats,beautiful,because,became,become,becomes,becoming,bed,bedded,bedding,beddings,bedroom,bedrooms,beds,been,beer,beers,before,began,begin,beginning,beginnings,begins,begun,behind,being,belief,beliefs,believe,believed,believer,believers,believes,believing,belong,belonged,belonging,belongings,belongs,below,bend,bended,bender,benders,bending,bends,beneath,bent,bents,beside,best,bested,besting,bests,better,bettered,bettering,betters,between,beyond,big,bigger,biggest,bird,birded,birding,birds,bit,bite,biter,biters,bites,bitey,biting,bits,black,blacker,blackest,blacking,blacks,blew,block,blocked,blocker,blockers,blocking,blocks,blood,blooded,bloods,blow,blower,blowers,blowing,blown,blows,blue,blued,bluer,blues,bluest,board,boarded,boarding,boardings,boards,boat,boated,boating,boatings,boats,bodies,body,bone,boned,bones,boning,book,booked,booking,bookings,books,boot,booted,booting,boots,bore,bored,boring,born,both,bother,bothered,botherer,botherers,bothering,bothers,bottle,bottled,bottles,bottling,bottom,bottomed,bottoming,bottoms,bought,box,boxed,boxes,boxing,boxings,boy,boys,brain,brained,braining,brains,branch,branched,branches,branching,branchings,break,breaker,breakers,breaking,breaks,breast,breasted,breasting,breasts,breath,breathe,breathed,breather,breathers,breathes,breathing,breathings,breaths,bridge,bridged,bridges,bridging,bright,brighter,brightest,bring,bringer,bringers,bringing,brings,broke,broken,brother,brothers,brought,brown,browned,browner,browning,brownings,browns,build,builder,builders,building,buildings,builds,built,burn,burned,burner,burners,burning,burnings,burns,burnt,bus,bused,buses,busied,busier,busiest,business,businesses,busing,busy,busying,but,buy,buyer,buyers,buying,buys,by,call,called,calling,callings,calls,calm,calmed,calmer,calmest,calming,calms,came,camera,cameras,can,can't,cannot,cans,car,cars,card,carded,carding,cards,care,cared,careful,carefully,cares,caring,carried,carrier,carriers,carries,carry,carrying,case,cased,cases,casing,casings,cat,cats,catted,catting,catch,catcher,catchers,catches,catching,catchings,caught,cause,caused,causer,causers,causes,causing,ceiling,ceilings,center,centered,centering,centers,certain,certainly,chair,chairs,chance,chanced,chancer,chances,chancing,change,changed,changer,changers,changes,changing,check,checked,checker,checkers,checking,checks,cheek,cheeked,cheeking,cheeks,chest,chests,child,children,choice,choicer,choices,choicest,choose,chooser,choosers,chooses,choosing,chose,chosen,church,churches,cigarette,cigarettes,circle,circled,circles,circling,cities,city,class,classes,clean,cleaned,cleaner,cleaners,cleanest,cleaning,cleanings,cleans,clear,cleared,clearer,clearest,clearing,clearings,clearly,clears,climb,climbed,climber,climbers,climbing,climbings,climbs,close,closed,closer,closers,closes,closest,closing,closings,clothe,clothed,clothes,clothing,clothings,cloud,clouded,clouding,clouds,coat,coated,coating,coatings,coats,coffee,coffees,cold,colder,coldest,colds,college,colleges,color,colored,colorer,colorers,colorful,coloring,colorings,colors,come,comes,coming,comings,companied,companies,company,companying,completely,computer,computers,confuse,confused,confuses,confusing,consider,considered,considering,considers,continue,continued,continues,continuing,control,controlled,controller,controllers,controlling,controls,conversation,conversations,cool,cooled,cooler,coolers,coolest,cooling,coolings,cools,cop,copped,copping,cops,corner,cornered,cornering,corners,could,couldn't,count,counted,counter,countered,countering,counters,counting,counts,countries,country,couple,couples,course,coursed,courses,coursing,cover,covered,covering,coverings,covers,crazier,crazies,craziest,crazy,create,created,creates,creating,creature,creatures,cried,cries,cry,crying,cross,crossed,crosser,crosses,crossing,crossings,crowd,crowded,crowding,crowds,cup,cupped,cupping,cups,cut,cuts,cutter,cutters,cutting,cuttings,dad,dads,dance,danced,dances,dancing,dancings,dark,darker,darkest,darkness,darknesses,darks,daughter,daughters,day,days,dead,deader,deadest,death,deaths,decide,decided,decider,deciders,decides,deciding,deep,deeper,deepest,deeps,desk,desks,despite,despites,did,didn't,die,died,dies,different,dinner,dinners,direction,directions,dirt,dirts,disappear,disappeared,disappearing,disappears,discover,discovered,discovering,discovers,distance,distanced,distances,distancing,do,doctor,doctored,doctoring,doctors,doer,doers,does,doesn't,dog,dogged,dogging,dogs,doing,doings,don't,done,door,doors,doorway,doorways,down,downed,downing,downs,dozen,dozens,drag,dragged,dragging,drags,drank,draw,drawing,drawings,drawn,draws,drew,dream,dreamed,dreaming,dreams,dress,dressed,dresses,dressing,dressings,dried,drier,driers,dries,driest,drink,drinker,drinkers,drinking,drinks,drive,driven,driver,drivers,drives,driving,drivings,drop,dropped,dropper,droppers,dropping,drops,drove,droves,drunk,drunks,dry,dryer,dryers,drying,during,dust,dusted,dusting,dusts,dying,dyings,each,ear,earlier,earliest,early,ears,earth,earthed,earthing,earths,easier,easiest,easily,east,eastest,easts,easy,eat,eaten,eater,eaters,eating,eats,edge,edged,edges,edging,edgings,effort,efforts,egg,egged,egging,eggs,eight,eights,either,else,emptied,emptier,empties,emptiest,empty,emptying,end,ended,ender,enders,ending,endings,ends,engine,engines,enjoy,enjoyed,enjoyer,enjoyers,enjoying,enjoys,enough,enoughs,enter,entered,entering,enters,entire,entires,especially,even,evened,evens,event,events,ever,every,everybody,everyone,everything,everywhere,exactly,except,excepted,excepting,excepts,excite,excited,excites,exciting,expect,expected,expecting,expects,explain,explained,explainer,explainers,explaining,explains,expression,expressions,extra,extras,eye,eyed,eyes,eying,face,faced,faces,facing,facings,fact,facts,fade,faded,fades,fading,fail,failed,failer,failers,failing,failings,fails,fall,fallen,faller,fallers,falling,falls,familiar,familiars,families,family,far,farther,farthest,fast,faster,fastest,father,fathered,fathering,fathers,fear,feared,fearing,fears,fed,feds,fee,feed,feeding,feedings,feeds,feeing,feel,feeling,feelings,feels,fees,feet,fell,felt,few,fewer,fewest,fews,field,fields,fight,fighter,fighters,fighting,fightings,fights,figure,figured,figures,figuring,figurings,fill,filled,filling,fillings,fills,final,finally,finals,find,finder,finders,finding,findings,finds,fine,fined,finer,fines,finest,finger,fingered,fingering,fingers,fining,finish,finished,finishes,finishing,finishings,fire,fired,fires,firing,firings,first,firsts,fish,fished,fishes,fishing,fit,fits,fitted,fitter,fitters,fittest,fitting,fittings,five,fiver,fives,fix,fixed,fixer,fixers,fixes,fixing,fixings,flash,flashed,flashes,flashing,flashings,flat,flats,flatted,flatter,flattest,flatting,flew,flier,fliers,flies,flight,flighted,flighting,flights,floor,floors,flower,flowered,flowering,flowers,flown,fly,flyer,flyers,flying,follow,followed,following,followings,follows,food,foods,foot,footed,footing,foots,for,force,forced,forces,forcing,forehead,foreheads,forest,forested,foresting,forests,forever,forget,forgets,forgetter,forgetters,forgetting,forgot,forgotten,form,formed,forming,forms,forward,forwarded,forwarding,forwards,fought,found,four,fours,free,freed,freeing,freeings,freer,freers,frees,freest,fresh,fresher,freshest,friend,friends,from,front,fronted,fronting,fronts,fuck,fucked,fucking,fuckings,fucks,full,fuller,fullest,fun,funnier,funnies,funniest,funny,further,furthest,future,futures,game,gamed,gamer,gamers,games,gaming,gamings,garden,gardened,gardening,gardens,gate,gated,gates,gather,gathered,gathering,gatherings,gathers,gating,gave,gently,get,gets,getter,getters,getting,gift,gifted,gifting,gifts,girl,girls,give,given,givens,gives,giving,glance,glanced,glances,glancing,glass,glassed,glasses,go,god,gods,goer,goers,goes,going,goings,gold,golder,goldest,golds,gone,good,goods,got,gotten,grab,grabbed,grabber,grabbers,grabbing,grabs,grandfather,grandfathers,grandmother,grandmothers,grass,grasses,gray,grayed,grayer,graying,grays,great,greater,greatest,greats,green,greened,greener,greenest,greening,greens,grew,grey,greyed,greyer,greying,greys,ground,grounds,group,grouped,grouping,groupings,groups,grow,growing,grown,grows,guard,guarded,guarding,guards,guess,guessed,guesses,guessing,gun,gunned,gunning,guns,guy,guyed,guying,guys,ha,had,hair,hairs,hairy,half,hall,halls,hallway,hallways,halve,halved,halves,halving,hand,handed,handing,hands,hang,hanger,hangers,hanging,hangings,hangs,happen,happened,happening,happenings,happens,happier,happiest,happy,hard,harder,hardest,hardly,has,hat,hate,hated,hates,hating,hats,hatted,hatting,have,haves,having,he,he's,head,headed,heading,headings,heads,hear,heard,hearing,hearings,hears,heart,hearts,heat,heated,heater,heaters,heating,heatings,heats,heavier,heavies,heaviest,heavy,held,hell,hello,hellos,hells,help,helped,helper,helpers,helping,helpings,helps,her,here,heres,hers,herself,hey,he’s,hi,hid,hidden,hide,hides,hiding,hidings,high,higher,highest,highs,hill,hilled,hilling,hills,him,himself,his,histories,history,hit,hits,hitter,hitters,hitting,hold,holder,holders,holding,holdings,holds,hole,holed,holes,holing,home,homed,homes,homing,hope,hoped,hopes,hoping,horse,horses,hospital,hospitals,hot,hotel,hotels,hotter,hottest,hour,hours,house,housed,houses,housing,housings,how,however,huge,huger,hugest,human,humans,hundred,hundreds,hung,hurried,hurries,hurry,hurrying,hurt,hurting,hurts,husband,husbanded,husbanding,husbands,i,i'd,i'll,i'm,ice,iced,ices,idea,ideas,if,ignore,ignored,ignorer,ignorers,ignores,ignoring,image,imaged,images,imagine,imagined,imaginer,imaginers,imagines,imaging,imagining,imaginings,immediately,important,in,information,informations,ins,inside,insides,instead,interest,interested,interesting,interests,into,is,isn't,isn’t,it,its,itself,i’d,i’ll,i’m,jacket,jacketed,jackets,job,jobs,join,joined,joiner,joiners,joining,joins,joke,joked,jokes,joking,jump,jumped,jumper,jumpers,jumping,jumps,just,keep,keeper,keepers,keeping,keepings,keeps,kept,key,keyed,keying,keys,kick,kicked,kicker,kickers,kicking,kicks,kid,kidded,kidding,kids,kill,killed,killer,killers,killing,killings,kills,kind,kinder,kindest,kinds,kiss,kissed,kisses,kissing,kissings,kitchen,kitchens,knee,knees,knew,knife,knifed,knifes,knifing,knives,knock,knocked,knocking,knockings,knocks,know,knowing,knowings,known,knows,ladies,lady,laid,land,landed,lander,landers,landing,landings,lands,language,languages,large,larger,largest,last,lasted,lasting,lasts,late,later,laugh,laughed,laughing,laughs,law,laws,lay,layer,layered,layers,laying,lays,lead,leaded,leader,leaders,leading,leadings,leads,leaf,leafing,leafs,lean,leaned,leaning,learn,learned,learning,learns,least,leave,leaved,leaves,leaving,led,left,leg,legs,less,lesser,let,lets,letter,lettered,lettering,letterings,letters,letting,lettings,liar,liars,lie,lied,lies,life,lift,lifted,lifter,lifters,lifting,lifts,light,lighted,lighter,lighters,lightest,lighting,lightings,lights,like,liked,liker,likers,likes,liking,likings,line,lined,lines,lining,linings,lip,lips,listen,listened,listening,listens,lit,little,littler,littlest,live,lived,lives,living,local,locals,lock,locked,locking,lockings,locks,long,longed,longer,longest,longing,longings,longs,look,looked,looker,lookers,looking,looks,lose,loses,losing,lost,lot,lots,loud,louder,loudest,love,loved,lover,lovers,loves,loving,low,lower,lowered,lowering,lowers,lowest,lowing,lows,luckier,luckiest,lucky,lunch,lunched,lunches,lunching,lying,machine,machined,machines,machining,mad,made,main,mains,make,maker,makers,makes,making,makings,man,manage,managed,manages,managing,manned,manning,mans,many,map,mapped,mapping,maps,mark,marked,marking,markings,marks,marriage,marriages,married,marrieds,marries,marry,marrying,matter,mattered,mattering,matters,may,maybe,mays,me,mean,meanest,meaning,meanings,means,meant,meet,meeting,meetings,meets,member,members,memories,memory,men,mens,mention,mentioned,mentioning,mentions,message,messaged,messages,messaging,met,metal,metals,middle,middled,middles,middling,middlings,might,mights,mind,minded,minding,minds,mine,mined,mining,minings,minute,minutes,mirror,mirrored,mirroring,mirrors,miss,missed,misses,missing,moment,moments,money,moneys,monies,month,months,moon,mooned,mooning,moons,more,mores,morning,mornings,most,mostly,mother,mothered,mothering,mothers,mountain,mountains,mouth,mouthed,mouthing,mouths,move,moved,mover,movers,moves,movie,movies,moving,much,music,musics,must,musts,my,myself,name,named,namer,namers,names,naming,narrow,narrowed,narrower,narrowest,narrowing,narrows,near,neared,nearer,nearest,nearing,nearly,nears,neck,necked,necking,neckings,necks,need,needed,needing,needs,neighbor,neighbors,never,new,newer,newest,news,next,nice,nicer,nicest,night,nights,no,nobodies,nobody,nod,nodded,nodding,nods,noes,noise,noised,noises,noising,none,nones,nor,normal,normals,north,norths,nos,nose,nosed,noses,nosing,not,note,noted,notes,nothing,nothings,notice,noticed,noticer,noticers,notices,noticing,noting,now,nows,numb,numbed,number,numbered,numbering,numberings,numbers,numbing,numbs,nurse,nursed,nurses,nursing,of,off,offed,offer,offered,offering,offerings,offers,office,officer,officered,officering,officers,offices,offing,offings,offs,often,oh,ohs,ok,ok'd,ok'ing,okay,okay'd,okayed,okaying,okays,okay’d,ok’d,ok’ing,old,older,oldest,olds,on,once,one,ones,only,onto,open,opened,opener,openers,opening,openings,opens,or,order,ordered,ordering,orderings,orders,ors,other,others,our,ours,out,outed,outer,outing,outings,outs,outside,outsides,over,overs,own,owned,owner,owners,owning,owns,page,paged,pages,paging,paid,pain,pained,paining,pains,paint,painted,painting,paintings,paints,pair,paired,pairing,pairings,pairs,pale,paled,paler,pales,palest,palm,palmed,palming,palms,pants,paper,papers,parent,parented,parenting,parents,part,parted,partied,parties,parting,partings,parts,party,partying,pass,passed,passes,passing,past,pasts,path,paths,pause,paused,pauses,pausing,pay,payed,paying,pays,people,peopled,peoples,peopling,perfect,perfected,perfecting,perfects,perhaps,person,personal,personals,persons,phone,phoned,phones,phoning,photo,photos,pick,picked,picking,pickings,picks,picture,pictured,pictures,picturing,piece,pieced,pieces,piecing,pile,piled,piles,piling,pilings,pink,pinked,pinker,pinking,pinks,place,placed,places,placing,plan,planned,planning,plans,plastic,plastics,plate,plated,plates,plating,platings,play,played,player,players,playing,plays,plea,pleas,please,pleased,pleases,pleasing,pleasings,pocket,pocketed,pocketing,pockets,point,pointed,pointer,pointers,pointing,points,pointy,police,policed,polices,policing,pool,pooled,pooling,pools,poor,poorer,poorest,pop,popped,popper,poppers,popping,pops,porch,porches,position,positioned,positioning,positions,possible,possibles,pour,poured,pourer,pourers,pouring,pours,power,powered,powering,powers,prepare,prepared,prepares,preparing,press,pressed,presser,pressers,presses,pressing,pressings,pretend,pretended,pretending,pretends,prettier,prettiest,pretty,probably,problem,problems,promise,promised,promiser,promisers,promises,promising,prove,proved,proven,prover,proves,proving,pull,pulled,puller,pullers,pulling,pullings,pulls,push,pushed,pusher,pushers,pushes,pushing,put,puts,putting,question,questioned,questioner,questioners,questioning,questionings,questions,quick,quicker,quickest,quickly,quicks,quiet,quieted,quieter,quieters,quietest,quieting,quietly,quiets,quite,radio,radios,rain,rained,raining,rains,raise,raised,raises,raising,ran,rang,rather,reach,reached,reacher,reachers,reaches,reaching,read,reader,readers,readied,readier,readies,readiest,reading,readings,reads,ready,readying,real,realer,realest,realize,realized,realizes,realizing,really,reason,reasoned,reasoning,reasons,receive,received,receives,receiving,recognize,recognized,recognizer,recognizers,recognizes,recognizing,red,redder,reddest,reds,refuse,refused,refuses,refusing,remain,remained,remaining,remains,remember,remembered,rememberer,rememberers,remembering,remembers,remind,reminded,reminding,reminds,remove,removed,removes,removing,repeat,repeated,repeating,repeatings,repeats,replied,replier,repliers,replies,reply,replying,rest,rested,resting,rests,return,returned,returning,returns,reveal,revealed,revealing,revealings,reveals,rich,richer,riches,richest,rid,ridden,ride,rider,riders,rides,riding,ridings,right,righted,righter,righting,rights,ring,ringed,ringing,ringings,rings,rise,risen,rises,rising,risings,river,rivers,road,roads,rock,rocked,rocking,rocks,rode,roll,rolled,rolling,rollings,rolls,roof,roofed,roofing,roofings,roofs,room,roomed,rooming,rooms,rooves,rose,roses,round,rounded,rounder,rounders,rounding,rounds,row,rowed,rowing,rowings,rows,rub,rubbed,rubbing,rubs,run,rung,runner,runners,running,runnings,runs,rush,rushed,rushes,rushing,sad,sadder,saddest,safe,safer,safes,safest,said,same,sames,sand,sanded,sanding,sands,sang,sat,save,saved,saver,savers,saves,saving,savings,saw,saws,say,saying,sayings,says,scare,scared,scarer,scarers,scares,scaring,scene,scenes,school,schooled,schooling,schoolings,schools,scream,screamed,screaming,screams,screen,screened,screening,screenings,screens,sea,search,searched,searches,searching,seas,seat,seated,seating,seatings,seats,second,seconded,seconding,seconds,see,seeing,seeings,seem,seemed,seeming,seems,seen,sees,sell,seller,sellers,selling,sells,send,sender,senders,sending,sends,sens,sense,sensed,senses,sensing,sent,serious,seriously,serve,served,serves,service,serviced,services,servicing,serving,servings,set,sets,setting,settings,settle,settled,settles,settling,settlings,seven,sevens,several,sex,sexed,sexes,sexing,shadow,shadowed,shadowing,shadows,shake,shaken,shaker,shakers,shakes,shaking,shape,shaped,shaper,shapers,shapes,shaping,share,shared,sharer,sharers,shares,sharing,sharp,sharper,sharpers,sharpest,sharps,shat,she,sheet,sheeted,sheeting,sheetings,sheets,ship,shipped,shipping,ships,shirt,shirted,shirting,shirts,shit,shits,shitting,shod,shoe,shoeing,shoes,shook,shoot,shooter,shooters,shooting,shootings,shoots,shop,shopped,shopping,shoppings,shops,short,shorter,shortest,shorts,shot,shots,should,shoulder,shoulders,shout,shouted,shouting,shouts,shove,shoved,shoves,shoving,show,showed,shower,showered,showering,showers,showing,showings,shown,shows,shrug,shrugged,shrugging,shrugs,shut,shuts,shutting,sick,sicked,sicker,sickest,sicking,sicks,side,sided,sides,siding,sigh,sighed,sighing,sighs,sight,sighted,sighting,sightings,sights,sign,signed,signing,signings,signs,silence,silenced,silences,silencing,silent,silver,silvered,silvering,silvers,simple,simpler,simples,simplest,simply,since,sing,singe,singing,singings,single,singled,singles,singling,sings,sir,sirs,sister,sisters,sit,sits,sitting,sittings,situation,situations,six,sixes,size,sized,sizes,sizing,skies,skin,skinned,skinning,skins,sky,slam,slammed,slamming,slams,sleep,sleeper,sleepers,sleeping,sleeps,slept,slid,slide,slider,sliders,slides,sliding,slightly,slip,slipped,slipping,slips,slow,slowed,slower,slowest,slowing,slowly,slows,small,smaller,smallest,smalls,smell,smelled,smelling,smells,smelly,smile,smiled,smiler,smilers,smiles,smiling,smoke,smoked,smoker,smokers,smokes,smoking,smokings,snap,snapped,snapping,snaps,snow,snowed,snowing,snows,so,soft,softer,softest,softly,sold,soldier,soldiered,soldiering,soldiers,some,somebodies,somebody,somehow,someone,someones,something,sometimes,somewhere,somewheres,son,song,songs,sons,soon,sorrier,sorriest,sorry,sort,sorted,sorting,sorts,sos,soul,souls,sound,sounded,sounder,sounders,soundest,sounding,soundings,sounds,south,southest,space,spaced,spaces,spacing,spacings,speak,speaker,speakers,speaking,speaks,special,specials,spend,spender,spenders,spending,spendings,spends,spent,spin,spinner,spinners,spinning,spinnings,spins,spirit,spirited,spiriting,spirits,spoke,spoken,spot,spots,spotted,spotting,sprang,spread,spreader,spreaders,spreading,spreadings,spreads,spring,springing,springs,sprung,spun,stage,stages,stair,stairs,stand,standing,standings,stands,star,stare,stared,starer,starers,stares,staring,starred,starring,stars,start,started,starter,starters,starting,starts,state,stated,states,stating,station,stationed,stationing,stations,stay,stayed,staying,stays,steal,stealer,stealers,stealing,steals,step,stepped,stepping,steps,stick,sticker,stickers,sticking,sticks,still,stole,stolen,stomach,stomached,stomaches,stomachs,stone,stones,stood,stop,stopped,stopper,stoppers,stopping,stops,store,stored,stores,stories,storing,storm,stormed,storming,storms,story,straight,straighter,straightest,straights,strange,stranger,strangers,strangest,street,streets,stretch,stretched,stretches,stretching,strike,strikes,striking,strikings,strong,stronger,strongest,struck,stuck,student,students,studied,studies,study,studying,stuff,stuffed,stuffing,stuffings,stuffs,stupid,stupider,stupidest,stupids,such,suddenly,suggest,suggested,suggesting,suggests,suit,suite,suited,suites,suiting,suitings,suits,summer,summers,sun,sung,sunned,sunning,suns,suppose,supposed,supposes,supposing,sure,surer,surest,surface,surfaced,surfaces,surfacing,surprise,surprised,surprises,surprising,sweet,sweeter,sweetest,sweets,swing,swinger,swingers,swinging,swings,swung,system,systems,table,tables,take,taken,taker,takers,takes,taking,takings,talk,talked,talker,talkers,talking,talks,tall,taller,tallest,taught,tea,teach,teacher,teachers,teaches,teaching,teachings,team,teamed,teaming,teams,tear,teared,tearing,tears,teas,teeth,teethed,teething,television,televisions,tell,telling,tellings,tells,ten,tens,terrible,than,thank,thanked,thanking,thanks,that,the,their,them,themselves,then,thens,there,these,they,thick,thicker,thickest,thicks,thin,thing,things,think,thinking,thinkings,thinks,thinned,thinner,thinners,thinnest,thinning,thins,third,thirds,thirties,thirty,this,those,though,thought,thoughts,three,threes,threw,throat,throats,through,throw,thrower,throwers,throwing,thrown,throws,tie,tied,ties,time,timed,timer,timers,times,timing,timings,tinier,tiniest,tiny,tire,tired,tires,tiring,to,today,todays,together,told,tomorrow,tomorrows,tone,toned,tones,tongue,tongued,tonguer,tonguers,tongues,tonguing,tonight,tonights,toning,too,took,tooth,toothed,toothy,top,topped,topping,toppings,tops,tore,torn,toss,tossed,tosses,tossing,touch,touched,toucher,touchers,touches,touching,touchings,toward,towards,town,towns,track,tracked,tracking,tracks,train,trained,training,trains,travel,traveled,traveler,travelers,traveling,travelings,travelled,traveller,travellers,travelling,travellings,travels,tree,treed,treeing,trees,tried,tries,trip,tripe,tripped,tripping,trips,trouble,troubled,troubles,troubling,truck,trucked,trucking,truckings,trucks,true,trued,truer,trues,truest,trust,trusted,truster,trusters,trusting,trusts,truth,truths,try,trying,turn,turned,turning,turnings,turns,tv,tvs,twenties,twenty,twice,two,twos,tying,uncle,uncles,under,understand,understanding,understandings,understands,understood,unless,until,up,upon,upped,upping,ups,us,use,used,uses,using,usual,usually,very,view,viewed,viewing,viewings,views,village,villages,visit,visited,visiting,visitor,visitors,visits,voice,voiced,voices,voicing,wait,waited,waiting,waitings,waits,wake,waked,wakes,waking,wakings,walk,walked,walker,walkers,walking,walkings,walks,wall,walled,walling,walls,want,wanted,wanter,wanters,wanting,wants,war,waring,warm,warmed,warmer,warmers,warmest,warming,warms,warred,warring,wars,was,wash,washed,washes,washing,washings,wasn't,wasn’t,watch,watched,watches,watching,watchings,water,watered,watering,waterings,waters,watery,wave,waved,waver,wavers,waves,waving,way,ways,we,wear,wearing,wearings,wears,wed,wedded,wedding,weddings,weds,week,weeks,weight,weighted,weighting,weightings,weights,well,wells,went,were,west,westest,wests,wet,wets,wetter,wetters,wettest,wetting,what,whatever,wheel,wheeled,wheeling,wheelings,wheels,when,where,whether,which,while,whisper,whispered,whispering,whispers,white,whited,whiter,whites,whitest,whiting,who,who's,whole,wholes,whom,whose,who’s,why,whys,wide,wider,widest,wife,wild,wilder,wildest,wilds,will,willed,willing,wills,win,wind,winded,winding,windings,window,windows,winds,windy,wine,wines,wing,winged,winging,wings,winning,wins,winter,wintered,wintering,winters,wipe,wiped,wiper,wipers,wipes,wiping,wish,wished,wishes,wishing,with,within,without,wives,woke,woken,woman,womans,women,womens,won,won't,wonder,wondered,wondering,wonders,won’t,wood,wooden,woods,word,worded,wording,wordings,words,wore,work,worked,worker,workers,working,workings,works,world,worlds,worn,worried,worries,worry,worrying,worse,worst,would,wouldn't,wouldn’t,wound,wrap,wrapped,wrapping,wrappings,wraps,write,writer,writers,writes,writing,writings,written,wrong,wronged,wronging,wrongs,wrote,yard,yards,yeah,year,years,yell,yelled,yelling,yellow,yellowed,yellower,yellowing,yellows,yells,yes,yeses,yet,you,young,younger,youngest,youngling,younglings,your,yourself diff --git a/futaba/cogs/optional/simplewriter/words/words.py b/futaba/cogs/optional/simplewriter/words/words.py new file mode 100644 index 00000000..c6d7034e --- /dev/null +++ b/futaba/cogs/optional/simplewriter/words/words.py @@ -0,0 +1,21 @@ +# +# cogs/optional/simplewriter/words/words.py +# +# futaba - A Discord Mod bot for the Programming server +# Copyright (c) 2017-2020 Jake Richardson, Ammon Smith, jackylam5 +# +# futaba is available free of charge under the terms of the MIT +# License. You are free to redistribute and/or modify it under those +# terms. It is distributed in the hopes that it will be useful, but +# WITHOUT ANY WARRANTY. See the LICENSE file for more details. +# + +import os + +__all__ = ["core_words_list"] + +core_words_list = [] +core_words_list_path = os.path.join(os.path.dirname(__file__), "core_words_list.txt") + +with open(core_words_list_path, "r") as f: + core_words_list = f.read().split(",") diff --git a/futaba/config.py b/futaba/config.py index 9cc6c525..fcc3dcb7 100644 --- a/futaba/config.py +++ b/futaba/config.py @@ -43,7 +43,7 @@ def wrapper(value): "prefix": str, "error-channel-id": Or(And(str, ID_REGEX.match), "0"), }, - "cogs": {"example": object, "statbot": object}, + "cogs": {"example": object, "statbot": object, "simplewriter": object}, "moderation": { "max-cleanup-messages": And(str, _check_gtz(int)), "ping-cooldown": And(str, _check_gtz(int)), diff --git a/misc/config.toml b/misc/config.toml index 4a97a5d0..45106c26 100644 --- a/misc/config.toml +++ b/misc/config.toml @@ -21,6 +21,12 @@ enabled = true enabled = false url = "postgres://statbot:passwordhere@localhost/statbot_ro" +[cogs.simplewriter] +enabled = false +# The ID of the text channel to enforce the simplewriter vocabulary in +# Set to "0" to implicitly disable simplewriter +channel-id = "0" + [moderation] # Maximum number of messages that may be specified # when doing a bulk message cleanup