Making the VC command and restricting it to only adminsitrators
This commit is contained in:
parent
a100d7a084
commit
556d0409e0
@ -5,4 +5,7 @@
|
||||
- How?
|
||||
* `briefly describe what this PR is doing to remedy the issue`
|
||||
- Why?
|
||||
* `is there an open issue associated with this PR? if so, reference it with #56 (or whatever the issue number is)`
|
||||
* `is there an open issue associated with this PR? if so, reference it with #56 (or whatever the issue number is)`
|
||||
- Is it...?
|
||||
* [ ] Based?
|
||||
* [ ] Dale-pilled?
|
5
app/bot.py
Executable file → Normal file
5
app/bot.py
Executable file → Normal file
@ -16,10 +16,7 @@ cogfiles = [
|
||||
]
|
||||
|
||||
for cogfile in cogfiles:
|
||||
try:
|
||||
bot.load_extension(cogfile)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
bot.load_extension(cogfile)
|
||||
|
||||
|
||||
@bot.event
|
||||
|
@ -1,6 +1,6 @@
|
||||
from discord.ext import commands
|
||||
import os
|
||||
import discord
|
||||
import os
|
||||
|
||||
|
||||
class ServerUtils(commands.Cog):
|
||||
@ -60,6 +60,7 @@ class ServerUtils(commands.Cog):
|
||||
return
|
||||
|
||||
@commands.command()
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def timeout(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@ -68,9 +69,6 @@ class ServerUtils(commands.Cog):
|
||||
*,
|
||||
reason=None,
|
||||
):
|
||||
if not ctx.message.author.discriminator in ["2528", "4082"]:
|
||||
return
|
||||
|
||||
import humanfriendly
|
||||
import datetime
|
||||
|
||||
@ -169,6 +167,46 @@ class ServerUtils(commands.Cog):
|
||||
await ctx.message.delete()
|
||||
await ctx.message.guild.leave()
|
||||
|
||||
@commands.command(name="vc")
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def vc(self, ctx: commands.Context, *, channel_role_name):
|
||||
# Check that the role/channel doesnt already exist
|
||||
# returns either a string or None, so we'll proceed on the None condition
|
||||
if discord.utils.find(
|
||||
lambda r: r.name == channel_role_name, ctx.message.guild.roles
|
||||
):
|
||||
await ctx.send(
|
||||
":x: A role named `%s` already exists :x:" % channel_role_name
|
||||
)
|
||||
return
|
||||
|
||||
# Create a role and assign it a random color
|
||||
try:
|
||||
role = await ctx.message.guild.create_role(
|
||||
name=channel_role_name,
|
||||
mentionable=True,
|
||||
hoist=True,
|
||||
color=discord.Color.random(),
|
||||
)
|
||||
|
||||
overwrites = {
|
||||
role: discord.PermissionOverwrite(connect=True, speak=True),
|
||||
ctx.message.guild.default_role: discord.PermissionOverwrite(
|
||||
connect=False
|
||||
),
|
||||
}
|
||||
|
||||
await ctx.message.guild.create_voice_channel(
|
||||
name=channel_role_name, bitrate=96000, overwrites=overwrites
|
||||
)
|
||||
|
||||
await ctx.send(
|
||||
":white_check_mark: Created a role + voice channel for %s"
|
||||
% role.mention
|
||||
)
|
||||
except Exception as e:
|
||||
await ctx.send(":x: Error: %s :x:" % e)
|
||||
|
||||
@commands.command(name="help")
|
||||
async def help(self, ctx: commands.Context, method):
|
||||
|
||||
|
@ -178,6 +178,11 @@ def get_help_message(method):
|
||||
"\nUsage: !youtube sick bmx tricks",
|
||||
],
|
||||
"wink": ["returns a anime girl winking at you", "\nUsage: !wink"],
|
||||
"vc": [
|
||||
"Creates a role and voice channel named whatever you pass in. Only takes one argument\n",
|
||||
"\nGives the role permissions to enter the voice channel\n"
|
||||
"\nUsage: !vc some_role_name",
|
||||
],
|
||||
"verify": [
|
||||
"Adds the twitter blue check mark to the previous message\n",
|
||||
"\nLiterally thats all it does\n" "\nUsage: !verify",
|
||||
@ -190,40 +195,41 @@ def get_help_message(method):
|
||||
def get_help_embed(bot):
|
||||
categories = {
|
||||
"fun": [
|
||||
"nft",
|
||||
"bf5",
|
||||
"ffxiv",
|
||||
"clap",
|
||||
"youtube",
|
||||
"excuse",
|
||||
"ffxiv",
|
||||
"greentext",
|
||||
"lewd",
|
||||
"message",
|
||||
"meme",
|
||||
"homepage",
|
||||
"horny",
|
||||
"lewd",
|
||||
"meme",
|
||||
"message",
|
||||
"nft",
|
||||
"owo",
|
||||
"pout",
|
||||
"roll",
|
||||
"smug",
|
||||
"owo",
|
||||
"wink",
|
||||
"verify",
|
||||
"horny",
|
||||
"wasted",
|
||||
"simp",
|
||||
"smug",
|
||||
"trackdays",
|
||||
"verify",
|
||||
"wasted",
|
||||
"wink",
|
||||
"youtube",
|
||||
],
|
||||
"util": [
|
||||
"8ball",
|
||||
"ask",
|
||||
"corona",
|
||||
"emoji",
|
||||
"8ball",
|
||||
"decide",
|
||||
"info",
|
||||
"emoji",
|
||||
"icon",
|
||||
"wallpaper",
|
||||
"info",
|
||||
"issue",
|
||||
"stock",
|
||||
"tts",
|
||||
"issue",
|
||||
"vc",
|
||||
"wallpaper",
|
||||
],
|
||||
"users": ["help", "invite", "purge", "roles", "source"],
|
||||
"pictures of animals": [
|
||||
|
@ -6,7 +6,7 @@ replicaCount: 1
|
||||
|
||||
image:
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: "171"
|
||||
tag: "172"
|
||||
repository: ldooks/dragon-bot
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user