This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |