diff options
author | romangraef <romangraef@loves.dicksinhisan.us> | 2018-09-16 21:48:21 +0200 |
---|---|---|
committer | romangraef <romangraef@loves.dicksinhisan.us> | 2018-09-16 21:48:21 +0200 |
commit | 8282428a268f87a0a4d68790521e57904826309e (patch) | |
tree | 1a2a093ed1e5fdef5d2c414120ff363a69562733 | |
parent | a4c058b5c0ec4e441c63ae2ef15235a4869d2bac (diff) | |
download | notaselfbotv2finalforsure-8282428a268f87a0a4d68790521e57904826309e.tar.gz notaselfbotv2finalforsure-8282428a268f87a0a4d68790521e57904826309e.tar.bz2 notaselfbotv2finalforsure-8282428a268f87a0a4d68790521e57904826309e.zip |
stuff
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.md | 22 | ||||
-rw-r--r-- | copypasta/ben.txt | 2 | ||||
-rw-r--r-- | copypasta/dick.txt | 1 | ||||
-rw-r--r-- | copypasta/history.txt | 1 | ||||
-rw-r--r-- | copypasta/mf.txt | 2 | ||||
-rw-r--r-- | copypasta/uwotcare.txt | 1 | ||||
-rw-r--r-- | copypasta/uwotowo.txt | 1 | ||||
-rw-r--r-- | copypasta/uwotsaint.txt | 2 | ||||
-rw-r--r-- | modules/carbon.py | 40 | ||||
-rw-r--r-- | modules/converters.py | 51 | ||||
-rw-r--r-- | modules/dump.py | 60 |
12 files changed, 183 insertions, 1 deletions
@@ -1 +1,2 @@ config/ +carbon-temp/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..05b0e27 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +## Installation + +The default installation stuff. +put the config in `config/config.json` with the following structure: + +```json +{ + "token": "discord-token", + "github": { + "access_token": "auio" + } +} +``` + +install the requirements. + +## Additional requirements. + +I use [carbon][carbon] to generate code images. We use the [carbon now cli][carbon-cli]. Please install it globally and generate a template called `notaselfbot` + +[carbon-cli]: https://github.com/mixn/carbon-now-cli +[carbon]: https://github.com/dawnlabs/carbon diff --git a/copypasta/ben.txt b/copypasta/ben.txt new file mode 100644 index 0000000..ea65f2d --- /dev/null +++ b/copypasta/ben.txt @@ -0,0 +1,2 @@ +Ben Shapiro TRIGGERS Liberal by SENDING them to NAZI DEATH CAMPS using pure CONSERVATIVE LOGIC and REASONING and then ANGERS SJW by GOING on a RAMPAGE literally RAPING and MURDERING every single MINORITY within a 200 MILE RADIUS then TROLLS Libtard with TRUMP DERANGEMENT SYNDROME by licking Donald Trumps MICROPENIS of all the DRIED CUM from the CONCEPTION of Barron Trump and he ANGERS democrat by FEEDING upon the FLESH of ABORTED FETUSES and the BLOOD of EVERY single LIBTARD to literally BECOME a GOD AMONG MEN which TROLLS idiot COMMIES by OPENING the seals of HELL and CAUSING the APOCALYPSE in which the DEVIL RAPES CHILDREN and TEARS OFF the heads of Liberal TODDLERS and LITERALLY setting WOMEN’s RIGHTS a THOUSAND YEARS and also Ben TRIGGERS the SOCIALISTS by RAPING the UNDEAD CORPSE of LEON TROTSKY and JOSEPH STALIN and he PISSES OFF the LEFTISTS by ESTABLISHING a NEW WORLD ORDER in which he is the SUPREME GOD EMPEROR OF ALL OF THE AMERICAS, CHINA, EUROPE, BRITAIN, TAIWAN, and THAT RANDOM ISLAND IN THE MIDDLE OF THE PACIFIC OCEAN and MURDERS all POLITICAL DISSIDENTS within the government and then he LITERALLY summons CTHULHU and have home and the DEVIL FUCK HIM IN THE ASS while he CUMS all OVER the BOTTLE of LIBERAL TEARS and then he PRANKS Chink Ugayer by IMITATING him and literally dying from the ANAL WOUNDS from Literally being FUCKED IN THE ASS by SATAN and CTHULHU and then ENRAGES the COMMIES by RAPING GOD and BECOMING the NEW ABSOLUTE RULER OF THE UNIVERSE!!!!! (LIBERALS TROLLED) (NOT CLICKBAIT) (SJWs and FEMINISTS OWNED) + diff --git a/copypasta/dick.txt b/copypasta/dick.txt new file mode 100644 index 0000000..577e6d6 --- /dev/null +++ b/copypasta/dick.txt @@ -0,0 +1 @@ +https://youtu.be/fUdsmUbs3s0
\ No newline at end of file diff --git a/copypasta/history.txt b/copypasta/history.txt new file mode 100644 index 0000000..8239b71 --- /dev/null +++ b/copypasta/history.txt @@ -0,0 +1 @@ +https://twitter.com/Pornhub/status/1031617323008974848 diff --git a/copypasta/mf.txt b/copypasta/mf.txt new file mode 100644 index 0000000..37c9233 --- /dev/null +++ b/copypasta/mf.txt @@ -0,0 +1,2 @@ +https://youtu.be/53zkBvL4ZB4 + diff --git a/copypasta/uwotcare.txt b/copypasta/uwotcare.txt new file mode 100644 index 0000000..2e322cc --- /dev/null +++ b/copypasta/uwotcare.txt @@ -0,0 +1 @@ +What the heck did you just flipping´ say about the Care Bears, you little uncaring person? I´ll have you know I graduated top of my class in Care-a-lot academy, and I´ve been involved in numerous secret raids on uncaring hearts, and I have over 300 confirmed Care Bears stares. I am trained in making uncaring hearts care and I´m the top leader in the entire Care Bears Family. You are nothing to me, but just another uncaring person. I will make you taste the rainbow in precisions the likes of wich has never been seen in Care-a-lot, mark my lovely words. You think that you can get away with saying that uncaring thing to us over the Internet? Think again, hateful person. As we speak, I am contacting all my fellow Care Bears Family members across Care-a-lot, and we are watching over a lunette right now, so you better prepare for the rainbow, uncaring one. The rainbow that will wipe out the hatred from your heart. You´re going to care kid. I can be anywhere, anytime, and I can make you taste the rainbow in over seven hundred ways, and that´s just with my belly badge. Not only am I extensively trained in the Care Bear Stare, but I have access to the entire rainbow cars of Care-a-lot, and I will use it to its full extent to make you care for all the people in the planet, you little uncaring person. If only you could have know what caring retribuition you little "clever" comment was about to bring down upon you, maybe you would have held your tongue. But you couldn´t, you didn´t, and now you´re paying the price, you hateful fella´. I will make you taste the rainbow, and you will love it. You´re going to care, kiddo. diff --git a/copypasta/uwotowo.txt b/copypasta/uwotowo.txt new file mode 100644 index 0000000..b630734 --- /dev/null +++ b/copypasta/uwotowo.txt @@ -0,0 +1 @@ +;;w;; What the fuck did you just fucking say about me, you wittwe bitch? I'ww have you knyow I gwaduated top of my cwass in the Nyavy Seaws, and I've been invowved in nyumewous secwet waids on Aw-Quaeda, and I have uvw 300 confiwmed kiwws. I am twainyed in gowiwwa wawfawe and I'm the top snyipew in the entiwe US awmed fowces. You awe nyothing to me but just anyothew tawget. I wiww wipe you the fuck out with pwecision the wikes of which has nyevew been seen befowe on this Eawth, mawk my fucking wowds. You think you can get away with saying that shit to me uvw the Intewnyet? Think again, fuckew. As we speak I am contacting my secwet nyetwowk of spies acwoss the USA and youw IP is being twaced wight nyow so you bettew pwepawe fow the stowm, maggot. The stowm that wipes out the pathetic wittwe thing you caww youw wife. You'we fucking dead, kid. I can be anywhewe, anytime, and I can kiww you in uvw seven hundwed ways, and that's just with my bawe hands. Nyot onwy am I extensivewy twainyed in unyawmed combat, but I have access to the entiwe awsenyaw of the Unyited States Mawinye Cowps and I wiww use it to its fuww extent to wipe youw misewabwe ass off the face of the continyent, you wittwe shit. If onwy you couwd have knyown what unhowy wetwibution youw wittwe "cwevew" comment was about to bwing down upon you, maybe you wouwd have hewd youw fucking tongue. But you couwdn't, you didn't, and nyow you'we paying the pwice, you goddamn idiot. I wiww shit fuwy aww uvw you and you wiww dwown in it. You'we fucking dead, kiddo. diff --git a/copypasta/uwotsaint.txt b/copypasta/uwotsaint.txt new file mode 100644 index 0000000..eaae5fa --- /dev/null +++ b/copypasta/uwotsaint.txt @@ -0,0 +1,2 @@ +What the fuck did you just fucking say about the seat of Saint Peter, you little heretic? I'll have you know I graduated top of my class in seminary, and I've been involved in numerous secret corruption coverups, and I have over 300 confirmed child molestation convictions. I am trained in apostolic succession and I'm the top theologian in the entire diocese. You are nothing to me but just another schismatic. I will wipe your heresy the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with removing the apocrypha? Think again, fucker. As we speak I am contacting the Virgin Mary (who I do NOT worship) and your lack of confession is being traced right now so you better prepare for the crusade, maggot. The crusade that wipes out the pathetic little thing you call your denomination. You're fucking refuted, kid. I can be anywhere, anytime, and I can cite the First Council of Nicaea to you in over seven hundred ways, and that's just with my vulgate. Not only am I extensively trained in abusing altar boys, but I have access to the entire arsenal of the Vatican and I will use it to its full extent to wipe your miserable church off the face of the continent, you little shit. If only you could have known what unholy retribution your little "faith alone" comment was about to bring down upon you, maybe you would have paid your fucking indulgences. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit holy water all over you and you will drown in it. You're fucking heretical, kiddo. Deus Vult. + diff --git a/modules/carbon.py b/modules/carbon.py new file mode 100644 index 0000000..1031586 --- /dev/null +++ b/modules/carbon.py @@ -0,0 +1,40 @@ +import re +from pathlib import Path +from subprocess import Popen, PIPE +from typing import Pattern + +from discord import File +from discord.ext.commands import Bot, command, Context + +from .converters import CodeBlock + +TEMP_DIR: Path = (Path(__file__).parent / '..' / 'carbon-temp').resolve() +TEMP_DIR.mkdir(parents=True, exist_ok=True) +regex: Pattern = re.compile(b" (/[^ ]+) ") + + +class Carbon(object): + def __init__(self, bot: Bot): + self.bot: Bot = bot + + @command() + async def carbon(self, ctx: Context, *, code_block: CodeBlock): + print('carbon thingies..') + temp_file: Path = (TEMP_DIR / ('carbon.' + code_block.extension)) + with temp_file.open('w') as cf: + cf.write(code_block.source) + proc = Popen(['carbon-now', '-p', 'notaselfbot', '-l', str(TEMP_DIR), str(temp_file)], stdout=PIPE) + proc.wait() + stdout, _ = proc.communicate() + match = None + for match in regex.finditer(stdout): + pass + if not match: + return await ctx.react('❌') + path = match.group(1).decode('ascii') + with open(path, 'br') as fp: + await ctx.send(file=File(fp, 'carbon.png')) + + +def setup(bot: Bot): + bot.add_cog(Carbon(bot)) diff --git a/modules/converters.py b/modules/converters.py index f86ff59..a84a03e 100644 --- a/modules/converters.py +++ b/modules/converters.py @@ -1,8 +1,59 @@ from string import digits from discord import TextChannel +from discord.ext import commands from discord.ext.commands import Converter, Context, Bot, BadArgument, converter +LANGUAGES = { + 'python': ['py', 'py3'], + 'javascript': ['js'], + 'c': ['c'], + 'cpp': ['c++', 'cpp', 'cxx'], + 'go': ['go'], + 'bash': [], + 'xml': [], + 'html': [], +} + +LANGUAGES_INV = { + **{v: k for k, v in LANGUAGES.items() for v in v}, + **{k: k for k in LANGUAGES.keys()}, +} + +EXTENSIONS = dict( + python='py', + c='c', + cpp='cpp', + bash='sh', + javascript='js', +) + + +class CodeBlock: + missing_error = 'Missing code block. Please use the following markdown\n\\`\\`\\`language\ncode here\n\\`\\`\\`' + + def __init__(self, argument): + try: + block, code = argument.split('\n', 1) + except ValueError: + raise commands.BadArgument(self.missing_error) + + if not block.startswith('```') and not code.endswith('```'): + raise commands.BadArgument(self.missing_error) + + language = block[3:] + self.language = self._get_language(language.lower()) + self.source = code.rstrip('`') + self.extension = self._get_extension(self.language) + + @staticmethod + def _get_extension(language): + return EXTENSIONS[language] + + @staticmethod + def _get_language(language): + return LANGUAGES_INV.get(language) + def is_int(text): return all(map(digits.__contains__, text)) diff --git a/modules/dump.py b/modules/dump.py index 5281d7d..05d10a9 100644 --- a/modules/dump.py +++ b/modules/dump.py @@ -1,6 +1,9 @@ +import re +from asyncio import sleep +from functools import wraps from typing import List -from discord import User, Embed, Profile, Guild, Member, Permissions, Message +from discord import User, Embed, Profile, Guild, Member, Permissions, Message, Role, Emoji, TextChannel from discord.ext.commands import Bot, command, Context as CommandContext, Context @@ -20,6 +23,17 @@ def dump_perms(permissions: Permissions): return ', '.join(perm_names()) +def then_delete(cmd): + @wraps(cmd) + async def func(*args, **kwargs): + mes = await cmd(*args, **kwargs) + if mes and hasattr(mes, 'delete'): + await sleep(30) + await mes.delete() + + return func + + class DumpCog(object): def __init__(self, bot: Bot): self.bot = bot @@ -31,6 +45,50 @@ class DumpCog(object): await ctx.send(content=f'```\n{escaped}\n```') await ctx.react('✅') + @command(aliases=['resolve']) + @then_delete + async def resolve_id(self, ctx: CommandContext, snowflake): + snowflake = re.sub(r'[^0-9]', '', snowflake) + if not snowflake: + return await ctx.send("No id") + snowflake = int(snowflake) + if snowflake <= 0: + return await ctx.send("Invalid id") + when = (snowflake >> 22) + 1420070400000 + worker = (snowflake & 0x3E0000) >> 17 + process = (snowflake & 0x1F000) >> 12 + increment = snowflake & 0xFFF + + channel: TextChannel = self.bot.get_channel(snowflake) + user: User = self.bot.get_user(snowflake) + guild: Guild = self.bot.get_guild(snowflake) + emoji: Emoji = self.bot.get_emoji(snowflake) + roles: List[Role] = [role for guild in self.bot.guilds for role in guild.roles if role.id == snowflake] + role: Role = roles[0] if len(roles) > 0 else None + + embed = Embed(title=f"ID: {snowflake}") + embed.add_field(name="When", value=str(when)) + embed.add_field(name="Worker", value=str(worker)) + embed.add_field(name="Process", value=str(process)) + embed.add_field(name="Increment", value=str(increment)) + + def add_if(name, thing, note=''): + if thing: + embed.add_field(name="Type", value=name) + embed.add_field(name="Data", value=f"```\n{thing!r}\n```{note}") + return True + return False + + if not any(x for x in [ + add_if("Guild", guild, "This may also be the default channel of the @everyone role of that server"), + add_if("Channel", channel), + add_if("User", user), + add_if("Role", role), + add_if("Emoji", emoji), + ]): + embed.add_field(name="Type", value="Not found.") + await ctx.send(embed=embed) + @command() async def user(self, ctx: CommandContext, user: User, guild: Guild = None): if guild is None and ctx.guild is not None: |