From d57129b33b5d8b4a7f07f5077dbdf66ab7c91b68 Mon Sep 17 00:00:00 2001 From: "Dusty.P" Date: Thu, 24 May 2018 21:20:57 -0800 Subject: [PATCH 01/14] Fixed gitignore --- .gitignore | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9b51d74..ab6f062 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +/Config.json +/PrivateConfig.json + # Byte-compiled / optimized / DLL files # Recurse @@ -108,8 +111,7 @@ venv.bak/ # mypy .mypy_cache/ -src/config/Config.json -PrivateConfig.json + # Ignore dockerfiles docker-compose.yml From 40487480803d342ec682b63a6e5e101f68401fe5 Mon Sep 17 00:00:00 2001 From: "Dusty.P" Date: Thu, 24 May 2018 21:28:08 -0800 Subject: [PATCH 02/14] deleted ignored files from repo so they are no longer tracked --- src/config/Config.json | 8 -------- src/config/PrivateConfig.json | 3 --- 2 files changed, 11 deletions(-) delete mode 100644 src/config/Config.json delete mode 100644 src/config/PrivateConfig.json diff --git a/src/config/Config.json b/src/config/Config.json deleted file mode 100644 index a301982..0000000 --- a/src/config/Config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": 0.1, - "display_name" : "[ds!] Dev-Sebi", - "maintenance": "True", - "ownerlist": [387871282756190208, 275280442884751360, 351794468870946827, 140652945032216576], - "prefix": "ds!", - "dbconnect": "" -} diff --git a/src/config/PrivateConfig.json b/src/config/PrivateConfig.json deleted file mode 100644 index 9fa108b..0000000 --- a/src/config/PrivateConfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "bot-key": "" -} \ No newline at end of file From d16087139f0ee428cd2cdd006192228fe8d7d72e Mon Sep 17 00:00:00 2001 From: "Dusty.P" Date: Thu, 24 May 2018 21:31:44 -0800 Subject: [PATCH 03/14] fixed .gitignore --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ab6f062..6108169 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -/Config.json -/PrivateConfig.json +Config.json +PrivateConfig.json # Byte-compiled / optimized / DLL files From 6d03a04853014b1e30549098f7305aff9f8f9906 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 25 May 2018 13:50:26 +0800 Subject: [PATCH 04/14] added moderation and fixed sar --- src/cogs.txt | 1 + src/cogs/contributors.py | 24 ---------------------- src/cogs/moderation.py | 44 ++++++++++++++++++++++++++++++++++++++++ src/cogs/sar.js | 7 ++++--- 4 files changed, 49 insertions(+), 27 deletions(-) create mode 100644 src/cogs/moderation.py diff --git a/src/cogs.txt b/src/cogs.txt index cbb47e8..ee91265 100644 --- a/src/cogs.txt +++ b/src/cogs.txt @@ -3,3 +3,4 @@ contributors code git fun +moderation diff --git a/src/cogs/contributors.py b/src/cogs/contributors.py index 4a888a6..bba7230 100644 --- a/src/cogs/contributors.py +++ b/src/cogs/contributors.py @@ -81,29 +81,5 @@ class Upload: else: await ctx.send(f'Loaded `{extension}`.') - @commands.command() - async def kick(self, ctx, member: discord.Member = None): - """ - Kick a discord member from your server. - Only contributors can use this command - - Usage: - - kick - - """ - 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.kick() - await ctx.send(f'You kicked **`{member.name}`** from **`{ctx.guild.name}`**') - - 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}`**' - f'\n\n```py\n{e}\n```') - def setup(bot): bot.add_cog(Upload(bot)) \ No newline at end of file diff --git a/src/cogs/moderation.py b/src/cogs/moderation.py new file mode 100644 index 0000000..4a3af64 --- /dev/null +++ b/src/cogs/moderation.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# -*- coding: -*- + +from discord.ext import commands +import discord + +class Moderation: + """ + Moderation Commands + """ + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def sar(self, ctx): + """Assign or remove self assigned roles""" + pass + + @commands.command() + async def kick(self, ctx, member: discord.Member = None): + """ + Kick a discord member from your server. + Only contributors can use this command + + Usage: + - kick + + """ + 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.kick() + await ctx.send(f'You kicked **`{member.name}`** from **`{ctx.guild.name}`**') + + 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}`**' + f'\n\n```py\n{e}\n```') + +def setup(bot): + bot.add_cog(Moderation(bot)) diff --git a/src/cogs/sar.js b/src/cogs/sar.js index 4d158cb..6d697c1 100644 --- a/src/cogs/sar.js +++ b/src/cogs/sar.js @@ -26,7 +26,8 @@ exports.run = async function(client, message, args) { .setDescription("Usage: `S!sar [ get | remove | list ] [ number ]`") .addField("1. Heroku Helper", "S!sar get 2", true) .addField("2. JS Helper", "S!sar get 3", true) - .addField("3. Rewrite Helper", "S!sar get 4", true); + .addField("3. Rewrite Helper", "S!sar get 4", true) + .setColor("AQUA"); return message.channel.send({ embed: embed @@ -49,10 +50,12 @@ exports.run = async function(client, message, args) { case "get": message.member.addRole(roles[choice]); + message.channel.send("Added the role you specified!"); // confirmation message break; case "remove": message.member.removeRole(roles[choice]); + message.channel.send("Removed the role you specified!"); // confirmation message break; default: @@ -61,6 +64,4 @@ exports.run = async function(client, message, args) { } - message.channel.send("Added the role you wanted!"); // confirmation message - } \ No newline at end of file From 22be527f5709f299858e85a615f34a13251ec822 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 25 May 2018 14:03:52 +0800 Subject: [PATCH 05/14] fixed embed fields --- src/cogs/sar.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cogs/sar.js b/src/cogs/sar.js index 6d697c1..1a5f7c7 100644 --- a/src/cogs/sar.js +++ b/src/cogs/sar.js @@ -24,9 +24,9 @@ exports.run = async function(client, message, args) { const embed = new Discord.RichEmbed() .setTitle("List of Self Assigned Roles") .setDescription("Usage: `S!sar [ get | remove | list ] [ number ]`") - .addField("1. Heroku Helper", "S!sar get 2", true) - .addField("2. JS Helper", "S!sar get 3", true) - .addField("3. Rewrite Helper", "S!sar get 4", true) + .addField("1. Heroku Helper", "S!sar get 1", true) + .addField("2. JS Helper", "S!sar get 2", true) + .addField("3. Rewrite Helper", "S!sar get 3", true) .setColor("AQUA"); return message.channel.send({ From c08dae28df10f05cf946045e2467a13f4fa8dca2 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 25 May 2018 14:06:20 +0800 Subject: [PATCH 06/14] changed encoding to utf-8 --- src/cogs/contributors.py | 2 +- src/cogs/example.py | 2 +- src/cogs/fun.py | 2 +- src/cogs/moderation.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cogs/contributors.py b/src/cogs/contributors.py index bba7230..69aca0a 100644 --- a/src/cogs/contributors.py +++ b/src/cogs/contributors.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# -*- coding: -*- +# -*- coding: utf-8 -*- from discord.ext import commands import discord diff --git a/src/cogs/example.py b/src/cogs/example.py index 4a73cbc..0376923 100644 --- a/src/cogs/example.py +++ b/src/cogs/example.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# -*- coding: -*- +# -*- coding: utf-8 -*- from discord.ext import commands import discord diff --git a/src/cogs/fun.py b/src/cogs/fun.py index d066435..ec56b83 100644 --- a/src/cogs/fun.py +++ b/src/cogs/fun.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# -*- coding: -*- +# -*- coding: utf-8 -*- from discord.ext import commands import discord diff --git a/src/cogs/moderation.py b/src/cogs/moderation.py index 4a3af64..d19b8ae 100644 --- a/src/cogs/moderation.py +++ b/src/cogs/moderation.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# -*- coding: -*- +# -*- coding: utf-8 -*- from discord.ext import commands import discord From 2d93458b70b67d03270e82c477270ca1cc4eb621 Mon Sep 17 00:00:00 2001 From: PuffDip Date: Fri, 25 May 2018 12:41:49 +0200 Subject: [PATCH 07/14] Updated requirements --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0927ad0..9b3af73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ yarl<1.2 numpy==1.14.0 -uvloop +uvloop==0.9.1 +aiohttp==3.2.1 \ No newline at end of file From 92e312fec3f567d47df9e676ea1bcf816f457b4d Mon Sep 17 00:00:00 2001 From: PuffDip Date: Fri, 25 May 2018 12:47:57 +0200 Subject: [PATCH 08/14] Each hour send a request to the free hosting service for Agg --- src/__main__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/__main__.py b/src/__main__.py index 824e5ec..284eddc 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -12,6 +12,7 @@ import random import traceback import os import sys +import aiohttp import discord from discord.ext import commands @@ -63,10 +64,28 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable): cog = cog.replace('\n', '') self.load_extension(f'src.cogs.{cog}') self.logger.info(f'Loaded: {cog}') + + async def keep_website_alive(self): + """ + Agg provided us with a personal website. + This is a free host and this free host provided us with a couple of rules + we have to adjust to. One of those rules is that each month atleast one request + have to be made with this website. Rule number 10 can be found here: + https://www.freewebhostingarea.com/agreement.html. + If anyone has a better solution feel free to edit this function. + """ + # Create client session + async with aiohttp.ClientSession() as session: + # Request url + async with session.get('http://chillout.ueuo.com/') as request: + # print the response status + print(f'http://chillout.ueuo.com/ status : {request.status}') + await asyncio.sleep(3600) # sleep for one hour async def on_ready(self): """On ready function""" self.maintenance and self.logger.warning('MAINTENANCE ACTIVE') + await self.keep_website_alive() async def on_command_error(self, ctx, error): """ From c96c88d76b3ab4563fcfd305ca1807c71b6afea4 Mon Sep 17 00:00:00 2001 From: PuffDip Date: Fri, 25 May 2018 12:50:49 +0200 Subject: [PATCH 09/14] Change call for new function --- src/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__main__.py b/src/__main__.py index 284eddc..872c286 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -85,7 +85,7 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable): async def on_ready(self): """On ready function""" self.maintenance and self.logger.warning('MAINTENANCE ACTIVE') - await self.keep_website_alive() + await asyncio.get_event_loop().create_task(self.keep_website_alive()) async def on_command_error(self, ctx, error): """ From feab37f4965252888e59f6bdbe5fb3ff218bb329 Mon Sep 17 00:00:00 2001 From: PuffDip Date: Fri, 25 May 2018 13:02:35 +0200 Subject: [PATCH 10/14] Change print in debug statement --- src/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__main__.py b/src/__main__.py index 872c286..1527442 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -79,7 +79,7 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable): # Request url async with session.get('http://chillout.ueuo.com/') as request: # print the response status - print(f'http://chillout.ueuo.com/ status : {request.status}') + self.logger.debug(f'http://chillout.ueuo.com/ status : {request.status}') await asyncio.sleep(3600) # sleep for one hour async def on_ready(self): From bffce08c93e87b3dafe017266886bdc8ed5c7440 Mon Sep 17 00:00:00 2001 From: PuffDip Date: Fri, 25 May 2018 13:13:25 +0200 Subject: [PATCH 11/14] Made status check readable in terminal to check if its working --- src/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__main__.py b/src/__main__.py index 1527442..4860c8a 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -79,7 +79,7 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable): # Request url async with session.get('http://chillout.ueuo.com/') as request: # print the response status - self.logger.debug(f'http://chillout.ueuo.com/ status : {request.status}') + self.logger.info(f'http://chillout.ueuo.com/ status : {request.status}') await asyncio.sleep(3600) # sleep for one hour async def on_ready(self): From ec7cfc34271a2da0c84e17681d7f24c7d8da3e95 Mon Sep 17 00:00:00 2001 From: PuffDip Date: Fri, 25 May 2018 13:43:02 +0200 Subject: [PATCH 12/14] remove junk --- src/__main__.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/__main__.py b/src/__main__.py index 4860c8a..d418558 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -12,7 +12,6 @@ import random import traceback import os import sys -import aiohttp import discord from discord.ext import commands @@ -65,27 +64,9 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable): self.load_extension(f'src.cogs.{cog}') self.logger.info(f'Loaded: {cog}') - async def keep_website_alive(self): - """ - Agg provided us with a personal website. - This is a free host and this free host provided us with a couple of rules - we have to adjust to. One of those rules is that each month atleast one request - have to be made with this website. Rule number 10 can be found here: - https://www.freewebhostingarea.com/agreement.html. - If anyone has a better solution feel free to edit this function. - """ - # Create client session - async with aiohttp.ClientSession() as session: - # Request url - async with session.get('http://chillout.ueuo.com/') as request: - # print the response status - self.logger.info(f'http://chillout.ueuo.com/ status : {request.status}') - await asyncio.sleep(3600) # sleep for one hour - async def on_ready(self): """On ready function""" self.maintenance and self.logger.warning('MAINTENANCE ACTIVE') - await asyncio.get_event_loop().create_task(self.keep_website_alive()) async def on_command_error(self, ctx, error): """ From 54ba203b90d89999fc0191ec4415611d2d4f7b69 Mon Sep 17 00:00:00 2001 From: Espy | Neko | 404 <34942042+neko404notfound@users.noreply.github.com> Date: Fri, 25 May 2018 20:39:43 +0100 Subject: [PATCH 13/14] Update requirements.txt (#28) --- requirements.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/requirements.txt b/requirements.txt index 9b3af73..501e963 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,10 @@ yarl<1.2 numpy==1.14.0 +aiofiles +# aiomultiprocess +# aiosqlite +# asyncpg +# dataclasses +# cached_property uvloop==0.9.1 aiohttp==3.2.1 \ No newline at end of file From 9fff91d2b58caddb17ce511e255fe08383a79a20 Mon Sep 17 00:00:00 2001 From: Nicholas Tanvis Date: Sun, 27 May 2018 10:04:34 +0800 Subject: [PATCH 14/14] fixed more stuff --- src/cogs/git.py | 2 +- src/cogs/moderation.py | 4 ++-- src/cogs/sar.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cogs/git.py b/src/cogs/git.py index 06645f6..2be5354 100644 --- a/src/cogs/git.py +++ b/src/cogs/git.py @@ -41,7 +41,7 @@ class Git(Loggable): @commands.group(case_insensitive=True, invoke_without_command=True) async def git(self, ctx): """Run help git for more info""" - await ctx.send('https://github.com/Annihilator708/Sebi-Machine/') + await ctx.send('https://github.com/dustinpianalto/Sebi-Machine/') @commands.command(case_insensitive=True, brief='Gets the Trello link.') async def trello(self, ctx): diff --git a/src/cogs/moderation.py b/src/cogs/moderation.py index d19b8ae..df0fb22 100644 --- a/src/cogs/moderation.py +++ b/src/cogs/moderation.py @@ -13,14 +13,14 @@ class Moderation: @commands.command() async def sar(self, ctx): - """Assign or remove self assigned roles""" + """Assign or remove self assigned roles.""" pass @commands.command() async def kick(self, ctx, member: discord.Member = None): """ Kick a discord member from your server. - Only contributors can use this command + Only contributors can use this command. Usage: - kick diff --git a/src/cogs/sar.js b/src/cogs/sar.js index 1a5f7c7..7cc25d4 100644 --- a/src/cogs/sar.js +++ b/src/cogs/sar.js @@ -19,7 +19,7 @@ exports.run = async function(client, message, args) { const type = args[0]; // can be get, remove or list - if (type == "list") { + if (type == "list" || type == undefined) { const embed = new Discord.RichEmbed() .setTitle("List of Self Assigned Roles")