Skip to content

Instantly share code, notes, and snippets.

@15696
Last active December 6, 2020 19:52
Show Gist options
  • Save 15696/2e0ea4b2a7e6a07ba5131c66607552ab to your computer and use it in GitHub Desktop.
Save 15696/2e0ea4b2a7e6a07ba5131c66607552ab to your computer and use it in GitHub Desktop.
A basic discord bot made entirely in a lambda. Featuring an on_ready event, a ping command, and the jishaku cog.
# thanks to mental32 on github for the idea
# thanks to sleep-cult#3040 on discord for the help
token = "put your token here"
(lambda c, a: [
f(c, a) for f in [
lambda c, a: [c.__setattr__(k, a.coroutine(v)) for k, v in {
"on_ready": lambda: print("Ready!"),
}.items()],
lambda c, a: [c.command(name = k)(a.coroutine(v)) for k, v in {
"ping": lambda ctx: c.loop.create_task(ctx.send("Pong!"))
}.items()],
lambda c, a: c.load_extension("jishaku"),
lambda c, a: c.run(token)
]
])(
__import__("importlib").import_module("discord.ext.commands").Bot(command_prefix = "lambda: "),
__import__("asyncio")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment