the hell is going on bro
This commit is contained in:
1 parent
b910c71bfe
commit
8ce5412f9d
3 files changed
+158
-21
No files matched your search
@@ -0,0 +1,35 @@
|
||||
from discord.ext import commands
|
||||
|
||||
# Copyright (C) Flumboni - All Rights Reserved
|
||||
# Unauthorized copying of this file, via any medium is strictly prohibited
|
||||
# Proprietary and confidential
|
||||
def check_flum():
|
||||
async def predicate(ctx):
|
||||
ids = [320825953154760704, 344273597612818444, 274983796414349313]
|
||||
return ctx.author.id not in ids
|
||||
return commands.check(predicate)
|
||||
|
||||
def check_bot():
|
||||
async def predicate(ctx):
|
||||
return not ctx.author.bot
|
||||
return commands.check(predicate)
|
||||
|
||||
async def check(ctx):
|
||||
ids = [232948417087668235, 124316478978785283, 131131701148647424]
|
||||
return ctx.author.id in ids
|
||||
def _check():
|
||||
return commands.check(check)
|
||||
|
||||
def get_user(message, user):
|
||||
try:
|
||||
member = message.mentions[0]
|
||||
except:
|
||||
member = message.guild.get_member_named(user)
|
||||
if not member:
|
||||
try:
|
||||
member = message.guild.get_member(int(user))
|
||||
except ValueError:
|
||||
pass
|
||||
if not member:
|
||||
return None
|
||||
return member
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from lib.checks import get_user
|
||||
|
||||
class Mod(commands.Cog):
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.has_permissions(manage_messages=True)
|
||||
@commands.command(aliases=['hban'], pass_context=True)
|
||||
async def hackban(self, ctx, user_id: int):
|
||||
author = ctx.message.author
|
||||
guild = author.guild
|
||||
|
||||
user = guild.get_member(user_id)
|
||||
if user is not None:
|
||||
return await ctx.invoke(self.ban, user=user)
|
||||
|
||||
try:
|
||||
await self.bot.http.ban(user_id, guild.id, 0)
|
||||
await ctx.send(f'Banned user: {user_id}')
|
||||
except discord.NotFound:
|
||||
await ctx.send('Could not find user. ')
|
||||
|
||||
except discord.errors.Forbidden:
|
||||
await ctx.send('Could not ban user. Not enough permissions.')
|
||||
|
||||
@commands.has_permissions(manage_messages=True)
|
||||
@commands.command(aliases=['p'], pass_context=True, no_pm=True)
|
||||
async def purge(self, ctx, msgs: int, members="everyone", *, txt=None):
|
||||
@property
|
||||
def destination(self):
|
||||
return self.context.message.author if self.bot.pm_help else self.context.message.channel
|
||||
|
||||
'''
|
||||
Purge last n messages or nmessages with a word. Requires Manage Messages permission. [p]help purge for more info.
|
||||
|
||||
Ex:
|
||||
|
||||
[p]purge 20 - deletes the last 20 messages in a channel sent by anyone.
|
||||
[p]purge 20 everyone stuff - deletes any messages in the last 20 messages that contain the word 'stuff'.
|
||||
[p]purge 20 @appu1232 - deletes any messages in the last 20 messages that were sent by appu1232.
|
||||
[p]purge 20 "@appu1232, LyricLy, 435254873976547426" hello - deletes any messages in the last 20 messages that were sent by appu1232, LyricLy or thecommondude that contain the word 'stuff'.
|
||||
'''
|
||||
await ctx.message.delete()
|
||||
content = f'I deleted {msgs} message(s) 👻'
|
||||
member_object_list = []
|
||||
if members != "everyone":
|
||||
member_list = [x.strip() for x in members.split(",")]
|
||||
for member in member_list:
|
||||
if "@" in member:
|
||||
member = member[3 if "!" in member else 2:-1]
|
||||
if member.isdigit():
|
||||
member_object = ctx.guild.get_member(int(member))
|
||||
else:
|
||||
member_object = ctx.guild.get_member_named(member)
|
||||
if not member_object:
|
||||
return await ctx.send(self.bot.bot_prefix + "Invalid user.")
|
||||
else:
|
||||
member_object_list.append(member_object)
|
||||
|
||||
if msgs < 10000:
|
||||
async for message in ctx.message.channel.history(limit=msgs):
|
||||
try:
|
||||
if txt:
|
||||
if not txt.lower() in message.content.lower():
|
||||
continue
|
||||
if member_object_list:
|
||||
if not message.author in member_object_list:
|
||||
continue
|
||||
|
||||
await message.delete()
|
||||
except discord.Forbidden:
|
||||
await ctx.send("I do not have permission to delete other users messages.")
|
||||
else:
|
||||
await ctx.send('Too many messages to delete. Enter a number < 10000')
|
||||
|
||||
await ctx.send(content=content,delete_after=15.0)
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Mod(bot))
|
||||
Reference in new issue
Block a user