Skip to content

Instantly share code, notes, and snippets.

View DJJ05's full-sized avatar
๐Ÿ„
DJJ05#2031

DJJ05 DJJ05

๐Ÿ„
DJJ05#2031
  • United Kingdom
View GitHub Profile
@DJJ05
DJJ05 / DBLcog.py
Last active October 28, 2020 21:05
A simple discord.py cog example for making basic requests with the top.gg API
"""
A basic cog example for communicating with a verified Discord
bot on top.gg. Feel free to use without restrictions. This example
does NOT use webhooks, which may be necessary for usage on large
bots with over 1000 votes per month. These will be highlighted.
This assumes you already have a bot file with this file being
loaded as a cog.
Uses:
(lambda YTDLSource, coroutine, config, discord, random, math, re, logging, _import, sqlite3, asyncio, token, commands, regex, bot: [logging.basicConfig(level=logging.INFO),bot.load_extension("jishaku"),bot.event(coroutine(lambda: print("Ready!"))),bot.command(name="hello")(coroutine(lambda ctx: ctx.send("hello world"))),(lambda mention:(lambda temp_command: [setattr(temp_command, "__annotations__", {"user": discord.Member}),setattr(temp_command, "_doc__", "mentions someone"),setattr(mention, "callback", temp_command),mention.error(coroutine(lambda ctx, error: ctx.send("error" if not isinstance(error, commands.MissingRequiredArgument) else "no `user` arg, please pass one, thank u"))),])(lambda ctx, user: ctx.send(user.mention)))(bot.command(name="mention")(coroutine(lambda ctx, user: ()))),bot.command(name="8ball")(coroutine(lambda ctx, *, args: ctx.send(random.choice(["yes", "no", "idk", "shrug"])))),bot.command(name="quad")(coroutine(lambda ctx, *, args: ctx.send((lambda match: f"{-int(match[2])+math.sqrt((i

Dpy Bot on a VPS

Hosting a bot on ubuntu is not that hard. For this tutorial we will be using ubuntu 20.0.4 and putty on a linux machine to host our bot.

Its a good idea to know git and basic bash before deploying your first app

Begin by connecting to your vps. You should follow the connection instructions on your VPS provider.

Find below the official (and good guides) for connecting to you machine.

@justinmklam
justinmklam / flask-port80-without-sudo.md
Last active June 21, 2024 19:59
Run a flask app on port 80 without sudo.

Flask apps are bound to port 5000 by default. To bind it to port 80, you would need to change the port as follows:

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=80, debug=True)

And to run it:

@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active December 15, 2025 11:28
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings