From a38c24b618944d138aaa61f413ca52cb7552ecba Mon Sep 17 00:00:00 2001 From: YashKandalkar Date: Wed, 6 Jun 2018 21:07:25 +0530 Subject: [PATCH 1/6] Commiting to development branch, added 'start' command --- src/cogs/BasicCommands.py | 44 +++++++++++++++++++++++++++++++++++++++ src/extensions.txt | 1 + 2 files changed, 45 insertions(+) create mode 100644 src/cogs/BasicCommands.py diff --git a/src/cogs/BasicCommands.py b/src/cogs/BasicCommands.py new file mode 100644 index 0000000..bcb27d0 --- /dev/null +++ b/src/cogs/BasicCommands.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# -*- coding: -*- + +from discord.ext import commands +import discord + +class BasicCommands: + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def start(self, ctx): + await ctx.send(f"Hello, {ctx.author.display_name}. Welcome to Sebi's Bot Tutorials. \nFirst off, would you like a quick walkthrough on the server channels?") + + #We can edit this later if the name of any channel changes. + channel_list = {'channel-1' : "#making-the-bot", + 'd.py-rewrite-start' : "#introduction-rw", + 'js-klasa-start' : "#introduction-js", + 'd.js' : "#introduction-discordjs"} + bots_channels = ("#bot-spam", "#bot-testing") + help_channels = ("#py-help", "#js-help", "#other-help") + + def check(m): + return True if m.author.id == ctx.author.id else False + + msg = await self.bot.wait_for('message', check = check, timeout = 15) + agree = ("yes", "yep", "yesn't", "ya") + + if msg is None: + await ctx.send("Sorry, {ctx.author.mention}, you didn't reply on time. You can run the command again when you're free :)") + else: + if msg.content.lower() in agree: + async with ctx.typing(): + await ctx.send("Alrighty-Roo...") + await ctx.send(f"To start making your bot from scratch, you first need to head over to {channel_list['channel-1']} (Regardless of the language you're gonna use.") + await ctx.send(f"After you have a bot account, you can either continue with {channel_list['d.py-rewrite-start']} if you want to make a bot in discord.py rewrite __or__ go to {channel_list['js-klasa-start']} or {channel_list['d.js']} for making a bot in JavaScript") + await ctx.send("...Read all the tutorials and still need help? You have two ways to get help.") + await ctx.send(f"**Method-1**\nThis is the best method of getting help. You help yourself.\nTo do so, head over to a bots dedicated channel (either {bots_channels[0]} or {bots_channels[1]}) and type `?rtfm rewrite thing_you_want_help_with`.\nThis will trigger the bot R.Danny Bot and will give you links on your query on the official discord.py rewrite docs. *PS: Let the page completely load*") + await ctx.send(f"**Method-2**\nIf you haven't found anything useful with Method-1, feel free to ask your question in any of the related help channels. ({', '.join(help_channels)})\nMay the force be with you!!") + else: + return await ctx.send("Session terminated. You can run this command again whenever you want.") + +def setup(bot): + bot.add_cog(BasicCommands(bot)) \ No newline at end of file diff --git a/src/extensions.txt b/src/extensions.txt index 4945aed..a47049f 100644 --- a/src/extensions.txt +++ b/src/extensions.txt @@ -5,3 +5,4 @@ code git fun moderation +BasicCommands From d2a93aaf2f524b04b6a77518434c6218f3d71ab8 Mon Sep 17 00:00:00 2001 From: "YashKandalkaril.com" Date: Thu, 7 Jun 2018 18:32:01 +0530 Subject: [PATCH 2/6] Changed channel names to channel IDs and added multiline strings --- src/cogs/BasicCommands.py | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/cogs/BasicCommands.py b/src/cogs/BasicCommands.py index bcb27d0..b69c5c5 100644 --- a/src/cogs/BasicCommands.py +++ b/src/cogs/BasicCommands.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# -*- coding: -*- +# -*- coding: utf-8 -*- from discord.ext import commands import discord @@ -12,18 +12,23 @@ class BasicCommands: async def start(self, ctx): await ctx.send(f"Hello, {ctx.author.display_name}. Welcome to Sebi's Bot Tutorials. \nFirst off, would you like a quick walkthrough on the server channels?") - #We can edit this later if the name of any channel changes. - channel_list = {'channel-1' : "#making-the-bot", - 'd.py-rewrite-start' : "#introduction-rw", - 'js-klasa-start' : "#introduction-js", - 'd.js' : "#introduction-discordjs"} - bots_channels = ("#bot-spam", "#bot-testing") - help_channels = ("#py-help", "#js-help", "#other-help") + channel_list = {'channel-1' : self.bot.get_channel(333149949883842561).mention, + 'd.py-rewrite-start' : self.bot.get_channel(386419285439938560).mention, + 'js-klasa-start' : self.bot.get_channel(341816240186064897).mention, + 'd.js' : self.bot.get_channel(436771798303113217).mention} + + bots_channels = (self.bot.get_channel(339112602867204097).mention, + self.bot.get_channel(411586546551095296).mention) + + help_channels = (self.bot.get_channel(425315253153300488).mention, + self.bot.get_channel(392215236612194305).mention, + self.bot.get_channel(351034776985141250).mention) def check(m): - return True if m.author.id == ctx.author.id else False + return True if m.author.id == ctx.author.id and m.channel.id == ctx.channel.id else False msg = await self.bot.wait_for('message', check = check, timeout = 15) + agree = ("yes", "yep", "yesn't", "ya") if msg is None: @@ -32,11 +37,18 @@ class BasicCommands: if msg.content.lower() in agree: async with ctx.typing(): await ctx.send("Alrighty-Roo...") - await ctx.send(f"To start making your bot from scratch, you first need to head over to {channel_list['channel-1']} (Regardless of the language you're gonna use.") - await ctx.send(f"After you have a bot account, you can either continue with {channel_list['d.py-rewrite-start']} if you want to make a bot in discord.py rewrite __or__ go to {channel_list['js-klasa-start']} or {channel_list['d.js']} for making a bot in JavaScript") + await ctx.send(f"""To start making your bot from scratch, you first need to head over to {channel_list['channel-1']} + (Regardless of the language you're gonna use).""") + await ctx.send(f"""After you have a bot account, you can either continue with {channel_list['d.py-rewrite-start']} + if you want to make a bot in discord.py rewrite __or__ go to {channel_list['js-klasa-start']} or + {channel_list['d.js']} for making a bot in JavaScript""") await ctx.send("...Read all the tutorials and still need help? You have two ways to get help.") - await ctx.send(f"**Method-1**\nThis is the best method of getting help. You help yourself.\nTo do so, head over to a bots dedicated channel (either {bots_channels[0]} or {bots_channels[1]}) and type `?rtfm rewrite thing_you_want_help_with`.\nThis will trigger the bot R.Danny Bot and will give you links on your query on the official discord.py rewrite docs. *PS: Let the page completely load*") - await ctx.send(f"**Method-2**\nIf you haven't found anything useful with Method-1, feel free to ask your question in any of the related help channels. ({', '.join(help_channels)})\nMay the force be with you!!") + await ctx.send(f"""**Method-1**\nThis is the best method of getting help. You help yourself.\n + To do so, head over to a bots dedicated channel (either {bots_channels[0]} or {bots_channels[1]}) + and type `?rtfm rewrite thing_you_want_help_with`.\nThis will trigger the bot R.Danny Bot and will + give you links on your query on the official discord.py rewrite docs. *PS: Let the page completely load*""") + await ctx.send(f"""**Method-2**\nIf you haven't found anything useful with Method-1, feel free to ask your question + in any of the related help channels. ({', '.join(help_channels)})\nMay the force be with you!!""") else: return await ctx.send("Session terminated. You can run this command again whenever you want.") From d8e8984af8c72ca2672d3b94e7ff23a957211a62 Mon Sep 17 00:00:00 2001 From: "YashKandalkaril.com" Date: Thu, 7 Jun 2018 18:39:32 +0530 Subject: [PATCH 3/6] added my name in __init__.py --- src/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__init__.py b/src/__init__.py index 693286b..e751564 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -6,7 +6,7 @@ Sebi-Machine. __author__ = 'Annihilator708' # TODO: add yourselves here. I can't remember everyones handles. -__contributors__ = (__author__, 'Neko404NotFound', 'Dusty.P', 'davfsa') +__contributors__ = (__author__, 'Neko404NotFound', 'Dusty.P', 'davfsa', 'YashKandalkar') __license__ = 'MIT' __title__ = 'Sebi-Machine' __version__ = 'tbd' From 0ae9b50a76560776b8df8bf2fcfa8e0a79d85164 Mon Sep 17 00:00:00 2001 From: Dustin Pianalto Date: Thu, 7 Jun 2018 09:20:04 -0800 Subject: [PATCH 4/6] Changed load message --- src/cogs/contributors.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cogs/contributors.py b/src/cogs/contributors.py index 4a888a6..f942184 100644 --- a/src/cogs/contributors.py +++ b/src/cogs/contributors.py @@ -74,10 +74,9 @@ class Upload: extension = extension.lower() try: self.bot.load_extension("src.cogs.{}".format(extension)) - except Exception as e: traceback.print_exc() - await ctx.send(f'Could not unload `{extension}` -> `{e}`') + await ctx.send(f'Could not load `{extension}` -> `{e}`') else: await ctx.send(f'Loaded `{extension}`.') From 22c6dd2a7d4a0b3373642a70802f453cce865675 Mon Sep 17 00:00:00 2001 From: Dustin Pianalto Date: Thu, 7 Jun 2018 09:23:39 -0800 Subject: [PATCH 5/6] renamed BasicCommands to basic_commands --- src/cogs/{BasicCommands.py => basic_commands.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/cogs/{BasicCommands.py => basic_commands.py} (100%) diff --git a/src/cogs/BasicCommands.py b/src/cogs/basic_commands.py similarity index 100% rename from src/cogs/BasicCommands.py rename to src/cogs/basic_commands.py From 049130e77d0ba7d078e0bce244d1d67604835051 Mon Sep 17 00:00:00 2001 From: Dustin Pianalto Date: Mon, 11 Jun 2018 13:50:46 -0800 Subject: [PATCH 6/6] fixed extension name --- src/extensions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extensions.txt b/src/extensions.txt index a47049f..d97db6c 100644 --- a/src/extensions.txt +++ b/src/extensions.txt @@ -5,4 +5,4 @@ code git fun moderation -BasicCommands +basic_commands