Skip to content

Instantly share code, notes, and snippets.

@Zomatree
Last active July 17, 2020 06:25
Show Gist options
  • Save Zomatree/7ea0fc5720b50a54495a0a2e92a64729 to your computer and use it in GitHub Desktop.
Save Zomatree/7ea0fc5720b50a54495a0a2e92a64729 to your computer and use it in GitHub Desktop.
(lambda sqlite3, asyncio, token, commands, regex, bot:[ globals().update(set_var=lambda k, v: globals().__setitem__(k, v)), set_var("_import", lambda module: set_var(module, __import__(module))), _import("config"), _import("discord"), _import("random"), _import("math"), _import("re"), _import("logging"),logging.basicConfig(level=logging.INFO),bot.load_extension("jishaku"),bot.command(name="hello")(asyncio.coroutine(lambda ctx: ctx.send("hello world"))),set_var("mention", bot.command(name="mention")(asyncio.coroutine(lambda ctx, user: ()))), set_var("temp_command", lambda ctx, user:ctx.send(user.mention)), setattr(temp_command, "__annotations__", {"user": discord.Member}), setattr(temp_command, "_doc__", "mentions someone"), setattr(mention, "callback", temp_command),mention.error(asyncio.coroutine(lambda ctx, error: ctx.send("error" if not isinstance(error, commands.MissingRequiredArgument) else "no `user` arg, please pass one, thank u"))), bot.command(name="8ball")(asyncio.coroutine(lambda ctx, *, args:ctx.send(random.choice(["yes","no","idk","shrug"])))), bot.command(name="quad")(asyncio.coroutine(lambda ctx, *,args: ctx.send((lambda match: f"{-int(match[2])+math.sqrt((int(match[2])**2)-4*int(match[1])*int(match[3]))/2*int(match[1])}, {-int(match[2])-math.sqrt((int(match[2])**2)-4*int(match[1])*int(match[3]))/2*int(match[1])}")(re.match(regex, args))))), set_var("purge", bot.command(name="purge")(asyncio.coroutine(lambda ctx, amount: ()))), set_var("temp_purge", (lambda ctx, amount: [bot.loop.create_task(ctx.channel.purge(limit = amount+1)),ctx.send(f"purged {amount}", delete_after=10)][1])), setattr(temp_purge, "__annotations__", {"amount": int}), setattr(purge, "callback", asyncio.coroutine(temp_purge)), purge.error(asyncio.coroutine(lambda ctx, error: ctx.send(f"```\n{error}\n```"))), set_var("YTDLSource", type("YTDLSource", (discord.PCMVolumeTransformer,), { "__init__": lambda self, source, *, data, volume=0.5: [ super(type(self), self).__init__(source, volume), setattr(self, "data", data), setattr(self, "title", data.get('title')),None][-1], "from_url": classmethod(lambda cls, url, *, loop=None, stream=None: (lambda data: cls(discord.FFmpegPCMAudio(data['url'] if stream else bot.ytdl.prepare_filename(data), options = "-vn"), data=data))((lambda data: data['entries'][0] if "entries" in data else data)(bot.ytdl.extract_info(url, download=not stream))))})),set_var("join", bot.command(name="join")(asyncio.coroutine(lambda ctx, *, channel: 0))), set_var("temp_join", lambda ctx, *, channel=None: (lambda channel: ctx.voice_client.move_to(channel) if ctx.voice_client is not None else channel.connect())(channel or ctx.author.voice.channel)),setattr(temp_join, "__annotations__", {"channel": discord.VoiceChannel}), setattr(join, "callback", asyncio.coroutine(temp_join)),set_var("play", bot.command(name="play")(asyncio.coroutine(lambda ctx, *, url: (lambda player: [ ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None), ctx.send('Now playing: {}'.format(player.title))])(YTDLSource.from_url(url, loop=bot.loop, stream=True))[-1]))),bot.command(name="volume")(asyncio.coroutine(lambda ctx, volume: [ctx.send("Not connected to a voice channel."), setattr(ctx.voice_client.source, "volume", int(volume) / 100),ctx.send("Changed volume to {}%".format(volume))][0 if ctx.voice_client is None else -1])), bot.command(name="stop")(asyncio.coroutine(lambda ctx: ctx.voice_client.disconnect())), play.before_invoke(asyncio.coroutine(lambda ctx: (ctx.author.voice.channel.connect() if ctx.author.voice else ctx.send("You are not connected to a voice channel."))if ctx.voice_client is None else ctx.voice_client.stop() if ctx.voice_client.is_playing() else None)), set_var("todo", bot.group(name="todo", invoke_without_command=True)(asyncio.coroutine(lambda ctx:ctx.send_help(ctx.command)))), todo.command(name="add")(asyncio.coroutine(lambda ctx, *, message: (lambda cur: [ cur.execute("""INSERT INTO "todo" VALUES (?, ?)""", (ctx.author.id, message)), bot.db.commit(), ctx.send(f"Added {message} to your todo list.")])(bot.db.cursor())[-1])), todo.command(name="list")(asyncio.coroutine(lambda ctx: (lambda embed: [ embed.set_author(name = str(ctx.author), icon_url = str(ctx.author.avatar_url_as(format="jpg", static_format="jpg"))), ctx.send(embed = embed)] )(discord.Embed(description="\n".join([f"{i}. {x[0]}" for i,x in enumerate(bot.db.cursor().execute("""SELECT Message FROM todo WHERE MemberID=?""", (ctx.author.id,)), 1)])))[-1])), bot.run(token)])(*(lambda sqlite3, asyncio, config, commands: (lambda bot: [ sqlite3, asyncio, config.token, commands, r"(-?\d+)x\^2([+-]\d+)x([+-]\d+)", bot ])(type("Bot", (commands.Bot,), { "__init__": lambda self, *args, **kwargs: [setattr(self, "owner_id", 285130711348805632), super(commands.Bot, self).__init__(*args, **kwargs)][-1], "get_context": lambda self, message, cls=None: super(commands.Bot, self).get_context(message, cls=type("LShiftContext", (__import__("discord.ext", globals(), locals(), ["commands"]).commands.Context,), {"__lshift__": lambda self, other: [(self.send(other), self.bot.loop), None][1]})), "on_ready": asyncio.coroutine(lambda self: print("Ready!")), "db": sqlite3.connect('todo.db'), "ytdl": __import__("youtube_dl").YoutubeDL({'format': 'bestaudio/best','outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s', 'restrictfilenames': True, 'noplaylist': True, 'nocheckcertificate': True, 'ignoreerrors': False, 'logtostderr': False, 'quiet': True, 'no_warnings': True, 'default_search': 'auto', 'source_address': '0.0.0.0'})} )(config.prefix, help_command=type("HelpCommand", (commands.MinimalHelpCommand,), { "get_command_signature": lambda self, command:f'{self.clean_prefix}{command.qualified_name} {command.signature}'})())) )(__import__("sqlite3"), __import__("asyncio"), __import__("config"), __import__("discord.ext", globals(), locals(), ["commands"]).commands) )
@CutieRei
Copy link

wew long one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment