Compare commits

..

49 Commits

Author SHA1 Message Date
Dusty.P
946590a3a1
Merge pull request #59 from dustinpianalto/pls-merge-me
Pls merge me
2018-06-21 10:49:08 -08:00
Dusty.P
222760f6a0
Merge branch 'development' into pls-merge-me 2018-06-21 10:48:39 -08:00
nya~
6f7e3b4bbc
Fixed another thingy regarding borked paths. 2018-06-21 19:35:02 +01:00
nya~
ba27d7c390
Removed a ) 2018-06-21 19:27:32 +01:00
nya~
0a9ab007e5
Fixed borked path for tags. 2018-06-21 19:26:58 +01:00
nya~
66d994023e
Removed junk from merge conflict issue. 2018-06-21 19:26:18 +01:00
nya~
08f1903871
Unborked a thing. 2018-06-21 19:25:12 +01:00
nya~
63d852f37b
Fixed syntax error. 2018-06-21 19:22:04 +01:00
davfsa
776b8d009c
Update bot_management.py 2018-06-21 20:19:16 +02:00
nya~
b189f2ca5e
Oops 2018-06-21 19:17:29 +01:00
davfsa
fe143678fe Updated some files 2018-06-21 20:04:07 +02:00
davfsa
8f70fcc142
Update sebi_machine_launcher.sh 2018-06-21 19:56:08 +02:00
davfsa
6b8bda9223 Merge branch 'neko404notfound-development' into development 2018-06-21 19:50:13 +02:00
davfsa
0a4baee373 Merge branch 'development' of https://github.com/neko404notfound/Sebi-Machine into neko404notfound-development 2018-06-21 19:49:24 +02:00
davfsa
1bd8873803
Fixed typos 2018-06-21 19:33:34 +02:00
davfsa
3fa91bbcce
Update bot_management.py 2018-06-21 19:06:20 +02:00
davfsa
38b6ff65a4
Update bot_management.py 2018-06-21 18:58:49 +02:00
davfsa
057e1210b7
Merge pull request #58 from AggPro/patch-5
Changed d.js-start back to d.js
2018-06-21 16:03:11 +02:00
Agg
76b5d1df8f
Changed d.js-start back to d.js
Because im too dumb
2018-06-21 15:42:44 +03:00
davfsa
f2fd478dc8
Merge pull request #57 from AggPro/patch-4
readded d.js-start
2018-06-21 13:28:24 +02:00
Agg
b7f90c990e
readded d.js-start
Because i am retarded and removed it
2018-06-21 13:50:11 +03:00
davfsa
edfebad791
Merge pull request #56 from AggPro/patch-3
added new responses to agree
2018-06-21 12:25:51 +02:00
Agg
d5194bba3d
added new responses to agree
And added async2rw to the tutorials
2018-06-21 12:32:31 +03:00
davfsa
2a9c202436
Update bot_management.py 2018-06-21 09:07:41 +00:00
davfsa
7f14b015ce
Update bot_management.py 2018-06-21 08:41:29 +00:00
davfsa
2eb5ac124c
Update bot_management.py 2018-06-21 08:40:23 +00:00
davfsa
788da95c11
Update bot_management.py 2018-06-21 08:31:36 +00:00
davfsa
40a182cc43
Update bot_management.py 2018-06-21 08:18:16 +00:00
davfsa
113737f2fd
Merge pull request #54 from AggPro/patch-2
Aaa
2018-06-20 20:28:09 +02:00
Agg
9267acf8fb
Aaa
wrong word lmao
2018-06-20 21:27:51 +03:00
davfsa
871a5f73be
Update bot_management.py 2018-06-20 20:20:06 +02:00
davfsa
327a5e74d2
Merge pull request #53 from AggPro/patch-1
Added ban command
2018-06-20 20:19:09 +02:00
Agg
02c3f1e685
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*
2018-06-20 21:17:31 +03:00
davfsa
7321413c90
Update bot_management.py 2018-06-20 20:03:28 +02:00
davfsa
c6efae9635
Update bot_management.py 2018-06-20 20:01:45 +02:00
davfsa
239261eeaf
Update bot_management.py 2018-06-20 19:55:50 +02:00
davfsa
423edf1a3a Merge remote-tracking branch 'origin/development' into development 2018-06-20 19:49:43 +02:00
davfsa
6b1dd09a98 Updated bot_management.py 2018-06-20 19:49:32 +02:00
davfsa
0f80146172 Updated bot_management.py 2018-06-20 19:49:03 +02:00
davfsa
6ae7113f5d
Merge pull request #52 from neko404notfound/patch-2
Fixed broken import someone didn't check.
2018-06-20 19:43:45 +02:00
neko404notfound
cd286222c1
Fixed broken import someone didn't check. 2018-06-20 18:42:48 +01:00
Dusty.P
db0391d8af
Merge pull request #51 from neko404notfound/patch-1
Fixed a stupid typo.
2018-06-20 09:40:18 -08:00
neko404notfound
7f2f4a32ca
Fixed a stupid typo. 2018-06-20 18:39:47 +01:00
Dustin Pianalto
39838d3e79 removed numpy import 2018-06-20 09:39:22 -08:00
davfsa
a76394b568
Update requirements.txt 2018-06-20 19:15:32 +02:00
davfsa
3ebf0e22f8
Merge pull request #50 from neko404notfound/neko404notfound-venv-patch
Update sebi_machine_launcher.sh
2018-06-20 19:04:07 +02:00
neko404notfound
becc2d3ade
Update sebi_machine_launcher.sh 2018-06-20 18:03:24 +01:00
neko404notfound
6b9a9cc968
Update sebi_machine_launcher.sh 2018-06-20 18:00:16 +01:00
davfsa
09384a7efa
Merge pull request #49 from neko404notfound/development
Requirements and traps.
2018-06-20 18:57:01 +02:00
4 changed files with 32 additions and 34 deletions

View File

@ -26,6 +26,8 @@ from .shared_libs.loggable import Loggable
# Init logging to output on INFO level to stderr.
logging.basicConfig(level="INFO")
REBOOT_FILE = "sebimachine/config/reboot"
# If uvloop is installed, change to that eventloop policy as it
# is more efficient
@ -75,13 +77,11 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable):
# Load plugins
# Add your cog file name in this list
with open(in_here("extensions.txt")) as cog_file:
cogs = cog_file.readlines()
cogs = {f'sebimachine.cogs.{c.strip()}' for c in cog_file.readlines()}
for cog in cogs:
# Could this just be replaced with `strip()`?
try:
cog = cog.replace("\n", "")
self.load_extension(f"src.cogs.{cog}")
self.load_extension(cog)
self.logger.info(f"Loaded: {cog}")
except (ModuleNotFoundError, ImportError) as ex:
logging.exception(f'Could not load {cog}', exc_info=(type(ex), ex, ex.__traceback__))
@ -90,7 +90,8 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable):
async def on_ready(self):
"""On ready function"""
self.maintenance and self.logger.warning("MAINTENANCE ACTIVE")
with open(f"src/config/reboot", "r") as f:
if os.path.exists(REBOOT_FILE):
with open(REBOOT_FILE, "r") as f:
reboot = f.readlines()
if int(reboot[0]) == 1:
await self.get_channel(int(reboot[1])).send("Restart Finished.")
@ -100,7 +101,7 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable):
f'FAILED TO LOAD {cog} BECAUSE OF {type(ex).__name__}: {ex}\n'
f'{tb}'
)
with open(f"src/config/reboot", "w") as f:
with open(REBOOT_FILE, "w") as f:
f.write(f"0")
async def on_command_error(self, ctx, error):

View File

@ -11,7 +11,7 @@ class BotManager:
return
else:
# The member is a bot
bot_owner = member.guild.get_member((await self.bot.db_con.fetchval('select owner from bots where id = $1', member.id))
bot_owner = member.guild.get_member(await self.bot.db_con.fetchval('select owner from bots where id = $1', member.id))
await bot_owner.add_roles(discord.utils.get(member.guild.roles, name='Bot Developers'))
await member.add_roles(discord.utils.get(member.guild.roles, name='Bots'))
@ -61,7 +61,7 @@ class BotManager:
await ctx.send(embed=em)
em = discord.Embed(title="Bot invite", colour=discord.Color(0x363941))
em.description = discord.utils.oauth_url(client_id, permissions=None, guild=ctx.guild))
em.description = discord.utils.oauth_url(client_id, permissions=None, guild=ctx.guild)
em.set_thumbnail(url=bot.avatar_url)
em.add_field(name="Bot name", value=bot.name)
em.add_field(name="Bot id", value="`" + str(bot.id) + "`")

View File

@ -8,7 +8,7 @@ import asyncio
class Tag:
def __init__(self, bot):
self.bot = bot
with open("src/shared_libs/tags.json", "r") as fp:
with open("sebimachine/shared_libs/tags.json", "r") as fp:
json_data = fp.read()
global tags
tags = json.loads(json_data)

View File

@ -174,38 +174,36 @@ def to_list_of_str(items, out: list = list(), level=1, recurse=0):
out = to_list_of_str(item, out, new_level, 1)
out.append(f'{" "*level}}}')
else:
out.append(
f'{" "*level}{quote+key+quote+": " if key else ""}{repr(item)},'
)
out.append(f'{" "*level}{quote+key+quote+": " if key else ""}{repr(item)},')
if type(items) == list:
if not recurse:
out = list()
out.append("[")
out.append('[')
for item in items:
rec_loop(item, None, out, level)
if not recurse:
out.append("]")
out.append(']')
elif type(items) == dict:
if not recurse:
out = list()
out.append("{")
out.append('{')
for key in items:
rec_loop(items[key], key, out, level)
if not recurse:
out.append("}")
out.append('}')
return out
def paginate(text, maxlen=1990):
paginator = Paginator(prefix="```py", max_size=maxlen + 10)
paginator = Paginator(prefix='```py', max_size=maxlen+10)
if type(text) == list:
data = to_list_of_str(text)
elif type(text) == dict:
data = to_list_of_str(text)
else:
data = str(text).split("\n")
data = str(text).split('\n')
for line in data:
if len(line) > maxlen:
n = maxlen
@ -221,8 +219,7 @@ async def run_command(args):
process = await asyncio.create_subprocess_shell(
args,
# stdout must a pipe to be accessible as process.stdout
stdout=asyncio.subprocess.PIPE,
)
stdout=asyncio.subprocess.PIPE)
# Wait for the subprocess to finish
stdout, stderr = await process.communicate()
# Return stdout