aboutsummaryrefslogtreecommitdiff
path: root/cogs
diff options
context:
space:
mode:
authorAnInternetTroll <lucafulger@gmail.com>2020-05-31 17:43:52 +0000
committerAnInternetTroll <lucafulger@gmail.com>2020-05-31 17:43:52 +0000
commitd7d868a43adb2bd3f89b4400288a397960e85769 (patch)
tree37d57254c1cdb823a8be7f9267c6dfcf491e5d26 /cogs
parent5731037878ad270803d2c3bbfe5b3980acb1ded8 (diff)
downloadsteve-bot-d7d868a43adb2bd3f89b4400288a397960e85769.tar
steve-bot-d7d868a43adb2bd3f89b4400288a397960e85769.tar.gz
steve-bot-d7d868a43adb2bd3f89b4400288a397960e85769.tar.bz2
steve-bot-d7d868a43adb2bd3f89b4400288a397960e85769.tar.lz
steve-bot-d7d868a43adb2bd3f89b4400288a397960e85769.tar.xz
steve-bot-d7d868a43adb2bd3f89b4400288a397960e85769.tar.zst
steve-bot-d7d868a43adb2bd3f89b4400288a397960e85769.zip
Replace Dyno
Diffstat (limited to 'cogs')
-rw-r--r--cogs/admin.py38
-rw-r--r--cogs/general.py1
-rw-r--r--cogs/help.py16
-rw-r--r--cogs/player.py5
-rw-r--r--cogs/utils.py4
5 files changed, 57 insertions, 7 deletions
diff --git a/cogs/admin.py b/cogs/admin.py
index 670ab34..f252944 100644
--- a/cogs/admin.py
+++ b/cogs/admin.py
@@ -1,5 +1,6 @@
from discord.ext import commands
import discord
+import asyncio
import subprocess
import json
import git
@@ -100,7 +101,42 @@ class Admin(commands.Cog):
@commands.command()
@commands.check(is_mod)
async def clear(self, ctx, number):
- await ctx.message.channel.purge(limit=int(number), check=None, before=None, after=None, around=None, oldest_first=False, bulk=True)
+ await ctx.message.channel.purge(limit=int(number)+1, check=None, before=None, after=None, around=None, oldest_first=False, bulk=True)
+
+ @commands.check(is_mod)
+ @commands.command()
+ async def mute(self, ctx, members: commands.Greedy[discord.Member],
+ mute_minutes: int = 0,
+ *, reason: str = "absolutely no reason"):
+ """Mass mute members with an optional mute_minutes parameter to time it"""
+
+ if not members:
+ await ctx.send("You need to name someone to mute")
+ return
+
+ #muted_role = discord.utils.find(ctx.guild.roles, name="Muted")
+ muted_role = ctx.guild.get_role(707707894694412371)
+ for member in members:
+ if self.bot.user == member: # what good is a muted bot?
+ embed = discord.Embed(title = "You can't mute me, I'm an almighty bot")
+ await ctx.send(embed = embed)
+ continue
+ await member.add_roles(muted_role, reason = reason)
+ await ctx.send("{0.mention} has been muted by {1.mention} for *{2}*".format(member, ctx.author, reason))
+
+ if mute_minutes > 0:
+ await asyncio.sleep(mute_minutes * 60)
+ for member in members:
+ await member.remove_roles(muted_role, reason = "time's up ")
+
+ @commands.check(is_mod)
+ @commands.command()
+ async def unmute(self, ctx, members: commands.Greedy[discord.Member]):
+ muted_role = ctx.guild.get_role(707707894694412371)
+ for i in members:
+ await i.remove_roles(muted_role)
+ await ctx.send("{0.mention} has been unmuted by {1.mention}".format(i, ctx.author))
+
def setup(bot):
diff --git a/cogs/general.py b/cogs/general.py
index 9dc2f18..091c325 100644
--- a/cogs/general.py
+++ b/cogs/general.py
@@ -2,7 +2,6 @@ from discord.ext import commands
import discord
import datetime
-
def dump(obj):
output = ""
for attr in dir(obj):
diff --git a/cogs/help.py b/cogs/help.py
index ac330f1..91c9c45 100644
--- a/cogs/help.py
+++ b/cogs/help.py
@@ -1,5 +1,10 @@
from discord.ext import commands
from random import randint
+import os, sys, inspect
+current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+parent_dir = os.path.dirname(current_dir)
+sys.path.insert(0, parent_dir)
+import bot
class MyHelpCommand(commands.MinimalHelpCommand):
messages = [
@@ -374,6 +379,17 @@ class Help(commands.Cog):
def cog_unload(self):
self.bot.help_command = self._original_help_command
+ @commands.command()
+ async def prefix(self, ctx):
+ prefixes = bot.get_prefix(self.bot, ctx.message)
+ prefixes.pop(1)
+ prefixes.pop(1)
+ prefixes.pop(1)
+ output = ""
+ for i in prefixes:
+ output += i+", "
+
+ await ctx.send(f"My prefixes are {output}")
def setup(bot):
bot.add_cog(Help(bot))
diff --git a/cogs/player.py b/cogs/player.py
index c977838..d7d2302 100644
--- a/cogs/player.py
+++ b/cogs/player.py
@@ -75,8 +75,6 @@ class Player(commands.Cog):
return await ctx.voice_client.move_to(channel)
await channel.connect()
-
- @commands.check(is_in_vc)
@commands.command()
async def play(self, ctx, *, query):
"""Plays a file from the local filesystem"""
@@ -85,8 +83,6 @@ class Player(commands.Cog):
ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None)
await ctx.send('Now playing: {}'.format(query))
-
- @commands.check(is_in_vc)
@commands.command()
async def yt(self, ctx, *, url):
"""Plays from a url (almost anything youtube_dl supports)"""
@@ -97,7 +93,6 @@ class Player(commands.Cog):
await ctx.send('Now playing: {}'.format(player.title))
- @commands.check(is_in_vc)
@commands.command()
async def stream(self, ctx, *, url):
"""Streams from a url (same as yt, but doesn't predownload)"""
diff --git a/cogs/utils.py b/cogs/utils.py
index f1cfeba..b7bc9f3 100644
--- a/cogs/utils.py
+++ b/cogs/utils.py
@@ -221,5 +221,9 @@ class Utils(commands.Cog):
async def someone(self, ctx):
await ctx.send(choice(ctx.guild.members).mention)
+ @commands.command()
+ async def roll(self, ctx, pool):
+ await ctx.send(f"You rolled a {randint(0, int(pool))}")
+
def setup(bot):
bot.add_cog(Utils(bot))