Skip to content

Instantly share code, notes, and snippets.

View izxxr's full-sized avatar

Izhar Ahmad izxxr

View GitHub Profile
@izxxr
izxxr / Github Webhook Tutorial.md
Created February 27, 2021 17:08 — forked from jagrosh/Github Webhook Tutorial.md
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
@izxxr
izxxr / eval.py
Created March 1, 2021 14:38 — forked from simmsb/eval.py
A good eval for discord.py
import ast
import discord
from discord.ext import commands
def insert_returns(body):
# insert return stmt if the last expression is a expression statement
if isinstance(body[-1], ast.Expr):
body[-1] = ast.Return(body[-1].value)
@izxxr
izxxr / README.MD
Last active October 8, 2024 19:02
Discord.py Webhook Guide (Both async and sync).

⚠️ Notice

This guide is for discord.py 1.7 version. In upcoming v2.0, Webhooks were greatly overhauled and in fact simplified a lot. They no longer require adapters. Usage of webhooks is now quite straight forward. As such, this guide is now outdated and should not be followed.

Furthermore, this guide is focused on discord.py. No support for forks are covered in this guide.

Basic Webhooks Example using Discord.py (Rewrite)

Webhooks are a great way to send messages to Discord without having a bot account. You just need a webhook URL and just do a POST request on that URL and the message will be sent to discord.

Webhooks can also be used if your bot has to send messages to a channel a lot. For example, If your bot has event logging so everytime having to fetch channel and sending can be slow so you can use some webhook magic.

@izxxr
izxxr / README.MD
Last active October 21, 2021 14:00

Basic Cogs Example (Discord.py rewrite)

This guide is on setting up cogs in discord.py.

What are cogs?

Cogs are used to split up your bot in different files.

Why cogs?

  • To organize your bot.
  • To avoid having tons of lines of codes in a single file.
  • To avoid messy code.
@izxxr
izxxr / README.MD
Last active August 3, 2021 13:22
Discord.py Quick Start
@izxxr
izxxr / gtn.py
Last active October 4, 2021 13:30
Guess the number game using Diskord Python library.
"""
Guess the number game using Diskord Python library.
This game uses slash commands.
"""
import diskord
import random
from diskord.ext import commands
# command_prefix is just a placeholder here it won't be used.
@izxxr
izxxr / coverage.md
Last active October 24, 2021 06:55

API Coverage of Diskord

Feature Status
Slash Commands Implemented
Message Commands Implemented
User Commands Implemented
Permissions for app commands Implemented
Autocomplete Implemented
Min & Max value on options Implemented
# Install Neocord (git required):
# pip install git+github.com/nerdguyahmad/neocord.git
import neocord
import random
import asyncio
import logging
client = neocord.Client(intents=neocord.GatewayIntents.all())
from typing import Optional
class ShittyRange:
"""A shitty implementation of range()."""
__slots__ = ('start', 'end', 'step', '_current')
start: int
end: int
step: int
OTAzOTU0MTMwODgyNjg2OTk2.YX0e4w.uPn9VhXbQx2_q9ndx-Sj9iaUQ-w