Update (#1)
* Update sebi_machine_launcher.sh * Update sebi_machine_launcher.sh * Update requirements.txt * removed numpy import * Fixed a stupid typo. * Fixed broken import someone didn't check. * Updated bot_management.py * Updated bot_management.py * Update bot_management.py * Update bot_management.py * Update bot_management.py * Added ban command And changed the response because if you were talking without commas you would need to breathe heavily and and and and *huff* * Update bot_management.py * Aaa wrong word lmao * Update bot_management.py
This commit is contained in:
parent
76f7e0c36e
commit
f6c4a5a570
@ -1,5 +1,4 @@
|
|||||||
yarl<1.2
|
yarl<1.2
|
||||||
numpy==1.14.0
|
|
||||||
aiofiles
|
aiofiles
|
||||||
# aiomultiprocess
|
# aiomultiprocess
|
||||||
# aiosqlite
|
# aiosqlite
|
||||||
|
|||||||
@ -5,6 +5,10 @@
|
|||||||
# the interrupt signal. This is really annoying over SSH when I have
|
# the interrupt signal. This is really annoying over SSH when I have
|
||||||
# a 1-second lag anyway.
|
# a 1-second lag anyway.
|
||||||
trap "echo 'Received interrupt. Exiting.'; exit 0" SIGINT
|
trap "echo 'Received interrupt. Exiting.'; exit 0" SIGINT
|
||||||
|
|
||||||
|
# Also loads the venv if it is present.
|
||||||
|
[ -d .venv/bin ] && source .venv/bin/activate && echo "Entered venv." || echo "No venv detected."
|
||||||
|
|
||||||
until python -m src; do
|
until python -m src; do
|
||||||
# Added colouring to ensure the date of shutdown and the exit code stands
|
# Added colouring to ensure the date of shutdown and the exit code stands
|
||||||
# out from the other clutter in the traceback that might have been output.
|
# out from the other clutter in the traceback that might have been output.
|
||||||
|
|||||||
@ -12,14 +12,24 @@ class BotManager:
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
# The member is a bot
|
# The member is a bot
|
||||||
# Add role testing bot
|
await member.add_roles(discord.utils.get(member.guild.roles, name='Bots'))
|
||||||
await member.add_roles(discord.utils.get(member.guild.roles, name='Bot to test'))
|
try:
|
||||||
await self.bot.db_con.fetch('select prefix from bots where id = $1', member.id)
|
await member.edit(nick='[' + await self.bot.db_con.fetch('select prefix from bots where id = $1', member.id)
|
||||||
await member.nick('[' + await self.bot.db_con.fetch('select prefix from bots where id = $1', member.id)
|
+ '] ' + member.name)
|
||||||
+ ']' + member.name)
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def on_member_remove(self, member):
|
||||||
|
# If the member is not a bot
|
||||||
|
if member.bot is False:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
# The member is a bot
|
||||||
|
await self.bot.db_con.execute('DELETE FROM bots WHERE id = $1', member.id)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def invite(self, ctx, bot: discord.User=None, prefix=None):
|
async def invite(self, ctx, bot=None, prefix=None):
|
||||||
|
bot = await ctx.bot.get_user_info(bot)
|
||||||
if not bot:
|
if not bot:
|
||||||
raise Warning('You must include the id of the bot you are trying to invite... Be exact.')
|
raise Warning('You must include the id of the bot you are trying to invite... Be exact.')
|
||||||
if not bot.bot:
|
if not bot.bot:
|
||||||
@ -42,7 +52,6 @@ class BotManager:
|
|||||||
await ctx.send(embed=em)
|
await ctx.send(embed=em)
|
||||||
|
|
||||||
em = discord.Embed(title="Bot invite", colour=discord.Color(0x363941))
|
em = discord.Embed(title="Bot invite", colour=discord.Color(0x363941))
|
||||||
em.description = "To start to test the bot, use `ds!start <bot_id>` and to finish testing it use `ds!finish`"
|
|
||||||
em.set_thumbnail(url=bot.avatar_url)
|
em.set_thumbnail(url=bot.avatar_url)
|
||||||
em.add_field(name="Bot name", value=bot.name)
|
em.add_field(name="Bot name", value=bot.name)
|
||||||
em.add_field(name="Bot id", value="`" + str(bot.id) + "`")
|
em.add_field(name="Bot id", value="`" + str(bot.id) + "`")
|
||||||
@ -50,67 +59,6 @@ class BotManager:
|
|||||||
em.add_field(name="Bot prefix", value="`" + prefix + "`")
|
em.add_field(name="Bot prefix", value="`" + prefix + "`")
|
||||||
await ctx.bot.get_channel(448803675574370304).send(embed=em)
|
await ctx.bot.get_channel(448803675574370304).send(embed=em)
|
||||||
|
|
||||||
@commands.command()
|
|
||||||
async def start(self, ctx, bot: discord.Member = None):
|
|
||||||
if not ctx.author.guild_permissions.manage_roles:
|
|
||||||
raise Warning('You are not allowed to execute this command')
|
|
||||||
if not bot:
|
|
||||||
raise Warning('You must include the id of the bot you are going to test... Be exact.')
|
|
||||||
|
|
||||||
if await self.bot.db_con.fetchrow('select * from bots where id = $1', bot.id):
|
|
||||||
if discord.utils.get(ctx.guild.roles, name='Bot to test') in bot.roles:
|
|
||||||
raise Warning('The bot is already being tested')
|
|
||||||
|
|
||||||
await bot.remove_roles(discord.utils.get(ctx.guild.roles, name='Bot to test'))
|
|
||||||
await bot.add_roles(discord.utils.get(ctx.guild.roles, name='Bot testing'))
|
|
||||||
|
|
||||||
user = await self.bot.db_con.fetch('select owner from bots where id = $1', bot.id)
|
|
||||||
await ctx.get_user(user).send('Your bot is being tested by ' + str(ctx.author))
|
|
||||||
await ctx.send('The owner has been warned')
|
|
||||||
else:
|
|
||||||
raise Warning('The bot id that you provided could not be found on the database')
|
|
||||||
|
|
||||||
@commands.group()
|
|
||||||
async def finish(self, ctx):
|
|
||||||
if ctx.invoked_subcommand is not None:
|
|
||||||
await ctx.send("Do `ds!help finish` for more info")
|
|
||||||
|
|
||||||
@finish.command()
|
|
||||||
async def approve(self, ctx, bot: discord.Member = None):
|
|
||||||
if not ctx.author.guild_permissions.manage_roles:
|
|
||||||
raise Warning('You are not allowed to execute this command')
|
|
||||||
if not bot:
|
|
||||||
raise Warning('You must include the id of the bot you have finished testing... Be exact.')
|
|
||||||
|
|
||||||
if await self.bot.db_con.fetchrow('select * from bots where id = $1', bot.id):
|
|
||||||
user = await self.bot.db_con.fetch('select owner from bots where id = $1', bot.id)
|
|
||||||
|
|
||||||
await bot.remove_roles(discord.utils.get(ctx.guild.roles, name='Bot testing'))
|
|
||||||
await bot.add_roles(discord.utils.get(ctx.guild.roles, name='Bot'))
|
|
||||||
|
|
||||||
await ctx.get_user(user).send('Your bot has been tested by ' + str(ctx.author) + '\n**Result:** Approved')
|
|
||||||
await ctx.send('The owner has been warned')
|
|
||||||
else:
|
|
||||||
raise Warning('The bot id that you provided could not be found on the database')
|
|
||||||
|
|
||||||
@finish.command()
|
|
||||||
async def decline(self, ctx, bot: discord.Member = None, reason=None):
|
|
||||||
if not ctx.author.guild_permissions.manage_roles:
|
|
||||||
raise Warning('You are not allowed to execute this command')
|
|
||||||
if not bot:
|
|
||||||
raise Warning('You must include the id of the bot you have finished testing... Be exact.')
|
|
||||||
if not reason:
|
|
||||||
raise Warning('You must include the reason for declining the bot... Be exact.')
|
|
||||||
|
|
||||||
if await self.bot.db_con.fetchrow('select * from bots where id = $1', bot.id):
|
|
||||||
user = await self.bot.db_con.fetch('select owner from bots where id = $1', bot.id)
|
|
||||||
await bot.kick()
|
|
||||||
await ctx.get_user(user).send('Your bot has been tested by ' + str(ctx.author) +
|
|
||||||
'\n**Result:** Declined\n**Reason:** ' + reason)
|
|
||||||
await ctx.send('The owner has been warned')
|
|
||||||
else:
|
|
||||||
raise Warning('The bot id that you provided could not be found on the database')
|
|
||||||
|
|
||||||
@commands.command(name='claim', aliases=['makemine', 'gimme'])
|
@commands.command(name='claim', aliases=['makemine', 'gimme'])
|
||||||
@commands.cooldown(1, 5, commands.BucketType.user)
|
@commands.cooldown(1, 5, commands.BucketType.user)
|
||||||
async def _claim_bot(self, ctx, bot: discord.Member = None, prefix: str = None, owner: discord.Member = None):
|
async def _claim_bot(self, ctx, bot: discord.Member = None, prefix: str = None, owner: discord.Member = None):
|
||||||
|
|||||||
@ -32,7 +32,30 @@ class Moderation:
|
|||||||
await ctx.send(f'You kicked **`{member.name}`** from **`{ctx.guild.name}`**')
|
await ctx.send(f'You kicked **`{member.name}`** from **`{ctx.guild.name}`**')
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await ctx.send('You may not use this command you do not have permission in server:\n\n**`{ctx.guild.name}`**'
|
await ctx.send('You may not use this command, as you do not have permission to do so:\n\n**`{ctx.guild.name}`**'
|
||||||
|
f'\n\n```py\n{e}\n```')
|
||||||
|
@commands.command()
|
||||||
|
async def ban(self, ctx, member: discord.Member = None):
|
||||||
|
"""
|
||||||
|
Ban a discord member from your server.
|
||||||
|
Only contributors can use this command.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
- ban <discord.member>
|
||||||
|
|
||||||
|
"""
|
||||||
|
await ctx.trigger_typing()
|
||||||
|
if ctx.author.id not in self.bot.ownerlist:
|
||||||
|
return await ctx.send('Only my contributors can use me like this :blush:', delete_after=10)
|
||||||
|
|
||||||
|
if member is None:
|
||||||
|
await ctx.send('Are you sure you are capable of this command?')
|
||||||
|
try:
|
||||||
|
await member.ban()
|
||||||
|
await ctx.send(f'You banned **`{member.name}`** from **`{ctx.guild.name}`**')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
await ctx.send('You may not use this command, as you do not have permission to do so:\n\n**`{ctx.guild.name}`**'
|
||||||
f'\n\n```py\n{e}\n```')
|
f'\n\n```py\n{e}\n```')
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from discord.ext import commands
|
|||||||
import youtube_dl
|
import youtube_dl
|
||||||
|
|
||||||
# noinspection PyUnresolvedReferences,PyUnresolvedReferences,PyPackageRequirements
|
# noinspection PyUnresolvedReferences,PyUnresolvedReferences,PyPackageRequirements
|
||||||
from utils import noblock
|
from . utils import noblock
|
||||||
|
|
||||||
|
|
||||||
YT_DL_OPTS = {
|
YT_DL_OPTS = {
|
||||||
|
|||||||
@ -32,7 +32,6 @@ import sys
|
|||||||
import asyncio
|
import asyncio
|
||||||
import discord
|
import discord
|
||||||
from discord.ext.commands.formatter import Paginator
|
from discord.ext.commands.formatter import Paginator
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
|
|
||||||
class Capturing(list):
|
class Capturing(list):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user