Skip to content

Instantly share code, notes, and snippets.

View jpanahon's full-sized avatar

J. Panahon jpanahon

  • 15:55 (UTC -04:00)
View GitHub Profile
@jpanahon
jpanahon / bot_example.py
Last active July 25, 2021 05:57 — forked from EvieePy/bot_example.py
A Cogs Example for the rewrite version of - discord.py
import discord
from discord.ext import commands
import sys, traceback
"""This is a multi file example showcasing many features of the command extension and the use of cogs.
These are examples only and are not intended to be used as a fully functioning bot. Rather they should give you a basic
understanding and platform for creating your own bot.
These examples make use of Python 3.6.2 and the rewrite version on the lib.
@jpanahon
jpanahon / paginator.py
Last active May 8, 2021 17:20
Lazy reaction paginator (can work without manage messages permissions and works for both embed and text) for the rewrite branch of discord.py
# I know it looks like R.Danny's paginator, I looked at it for reference to try to figure out how to do the paginating and wrote it
# in my own way. So don't accuse me of stealing code and modifying it to my own liking. In some ways or another, this paginator is simply
# a more efficient version of the paginator found in ?tag help command (assuming you came here from discord.py).
class Paginator:
def __init__(self, ctx, entries: list, embed=True):
self.bot = ctx.bot
self.ctx = ctx
self.entries = entries
self.embed = embed
@jpanahon
jpanahon / help.py
Last active July 25, 2021 05:57
Help example for the rewrite branch of discord.py
# NOTICE: Before you copy this example, be sure you understand what all this does. Remember: This is a gist, not a github file meaning
# you can't pip install this, you would need to put this into a new file and add it to your cog list.
import discord
import asyncio
from discord.ext import commands
def chunks(l, n):
@jpanahon
jpanahon / moderation.py
Last active April 29, 2023 07:39
An advanced moderation cog for the rewrite branch of discord.py
import discord
from discord.ext import commands
# This prevents staff members from being punished
class Sinner(commands.Converter):
async def convert(self, ctx, argument):
argument = await commands.MemberConverter().convert(ctx, argument) # gets a member object
permission = argument.guild_permissions.manage_messages # can change into any permission
if not permission: # checks if user has the permission
return argument # returns user object