From 6f51cf18febdfdf8d8949e3a3a91d707ed2d9dc2 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Sun, 9 Aug 2020 14:06:35 -0700 Subject: Edited "topic" command for fetching python channel topics. --- bot/exts/easter/conversationstarters.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/exts/easter/conversationstarters.py b/bot/exts/easter/conversationstarters.py index a5f40445..0c773119 100644 --- a/bot/exts/easter/conversationstarters.py +++ b/bot/exts/easter/conversationstarters.py @@ -2,6 +2,7 @@ import json import logging import random from pathlib import Path +from discord import Embed from discord.ext import commands @@ -10,6 +11,10 @@ log = logging.getLogger(__name__) with open(Path("bot/resources/easter/starter.json"), "r", encoding="utf8") as f: starters = json.load(f) +with open(Path("bot/resources/easter/py_topics.json"), "r", encoding="utf8") as f: + # First ID is #python-general and the rest are top to bottom categories of Topical Chat/Help. + py_topics = json.load(f) + class ConvoStarters(commands.Cog): """Easter conversation topics.""" @@ -19,7 +24,25 @@ class ConvoStarters(commands.Cog): @commands.command() async def topic(self, ctx: commands.Context) -> None: - """Responds with a random topic to start a conversation.""" + """Responds with a random topic to start a conversation, changing depending on channel.""" + + # Fetching topics. + channel_topics = py_topic[str(ctx.channel.id)] + + if channel_topics: + return await ctx.send(random.choice(channel_topics['python-channels'])) + + else: + # If the channel ID doesn't have any topics. + embed = Embed( + description=( + "No topics found. You can suggest new ideas for topics " + "[here](https://github.com/python-discord/seasonalbot/issues/426)!" + )) + + return await ctx.send(embed=embed) + + # If the channel isn't Python. await ctx.send(random.choice(starters['starters'])) -- cgit v1.2.3 From 4d6e9f2b692939eccd8fed414f063f6bd3de858f Mon Sep 17 00:00:00 2001 From: Xithrius Date: Sun, 9 Aug 2020 14:07:08 -0700 Subject: Added base file for python topics. With a couple suggestions for #python-general --- bot/resources/easter/py_topics.json | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 bot/resources/easter/py_topics.json (limited to 'bot') diff --git a/bot/resources/easter/py_topics.json b/bot/resources/easter/py_topics.json new file mode 100644 index 00000000..d1035b7a --- /dev/null +++ b/bot/resources/easter/py_topics.json @@ -0,0 +1,58 @@ +{ + "python-channels": { + "267624335836053506": [ + "What's your favorite PEP?", + "What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python?", + "What functionality is your text editor/IDE missing for programming Python?", + "What parts of your life has Python automated, if any?" + ], + "630504881542791169": [ + + ], + "650401909852864553": [ + + ], + "342318764227821568": [ + + ], + "366673247892275221": [ + + ], + "343944376055103488": [ + + ], + "470884583684964352": [ + + ], + "660625198390837248": [ + + ], + "545603026732318730": [ + + ], + "716325106619777044": [ + + ], + "728390945384431688": [ + + ], + "366674035876167691": [ + + ], + "463035728335732738": [ + + ], + "463035462760792066": [ + + ], + "491523972836360192": [ + + ], + "338993628049571840": [ + + ], + "366673702533988363": [ + + ] + } +} -- cgit v1.2.3 From 66061654ac708d6290c225808e6b9813051d5163 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Sun, 9 Aug 2020 15:46:03 -0700 Subject: Finalized topic selection. --- bot/exts/easter/conversationstarters.py | 45 +++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'bot') diff --git a/bot/exts/easter/conversationstarters.py b/bot/exts/easter/conversationstarters.py index 0c773119..212e65b7 100644 --- a/bot/exts/easter/conversationstarters.py +++ b/bot/exts/easter/conversationstarters.py @@ -2,18 +2,23 @@ import json import logging import random from pathlib import Path -from discord import Embed +from discord import Embed from discord.ext import commands +from bot.utils.decorators import override_in_channel + + log = logging.getLogger(__name__) + with open(Path("bot/resources/easter/starter.json"), "r", encoding="utf8") as f: starters = json.load(f) with open(Path("bot/resources/easter/py_topics.json"), "r", encoding="utf8") as f: # First ID is #python-general and the rest are top to bottom categories of Topical Chat/Help. - py_topics = json.load(f) + py_topics = json.load(f)["python-channels"] + all_python_channels = [int(channel_id) for channel_id in py_topics.keys()] class ConvoStarters(commands.Cog): @@ -23,27 +28,29 @@ class ConvoStarters(commands.Cog): self.bot = bot @commands.command() + @override_in_channel(all_python_channels) async def topic(self, ctx: commands.Context) -> None: - """Responds with a random topic to start a conversation, changing depending on channel.""" + """Responds with a random topic to start a conversation, changing depending on channel.""" + try: + # Fetching topics. + channel_topics = py_topics[str(ctx.channel.id)] - # Fetching topics. - channel_topics = py_topic[str(ctx.channel.id)] - - if channel_topics: - return await ctx.send(random.choice(channel_topics['python-channels'])) + if channel_topics: + return await ctx.send(random.choice(channel_topics)) - else: # If the channel ID doesn't have any topics. - embed = Embed( - description=( - "No topics found. You can suggest new ideas for topics " - "[here](https://github.com/python-discord/seasonalbot/issues/426)!" - )) - - return await ctx.send(embed=embed) - - # If the channel isn't Python. - await ctx.send(random.choice(starters['starters'])) + else: + embed = Embed( + description=( + "No topics found for this Python channel. You can suggest new ideas for topics " + "[here](https://github.com/python-discord/seasonalbot/issues/426)!" + )) + + return await ctx.send(embed=embed) + + except KeyError: + # If the channel isn't Python. + await ctx.send(random.choice(starters['starters'])) def setup(bot: commands.Bot) -> None: -- cgit v1.2.3 From 7756650dc337b913bba75cdc5b9f3dabc61b4c68 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 10 Aug 2020 13:03:13 -0700 Subject: Updated to comply with reviews. --- bot/exts/easter/conversationstarters.py | 58 ------------------------------ bot/exts/evergreen/conversationstarters.py | 57 +++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 58 deletions(-) delete mode 100644 bot/exts/easter/conversationstarters.py create mode 100644 bot/exts/evergreen/conversationstarters.py (limited to 'bot') diff --git a/bot/exts/easter/conversationstarters.py b/bot/exts/easter/conversationstarters.py deleted file mode 100644 index 212e65b7..00000000 --- a/bot/exts/easter/conversationstarters.py +++ /dev/null @@ -1,58 +0,0 @@ -import json -import logging -import random -from pathlib import Path - -from discord import Embed -from discord.ext import commands - -from bot.utils.decorators import override_in_channel - - -log = logging.getLogger(__name__) - - -with open(Path("bot/resources/easter/starter.json"), "r", encoding="utf8") as f: - starters = json.load(f) - -with open(Path("bot/resources/easter/py_topics.json"), "r", encoding="utf8") as f: - # First ID is #python-general and the rest are top to bottom categories of Topical Chat/Help. - py_topics = json.load(f)["python-channels"] - all_python_channels = [int(channel_id) for channel_id in py_topics.keys()] - - -class ConvoStarters(commands.Cog): - """Easter conversation topics.""" - - def __init__(self, bot: commands.Bot): - self.bot = bot - - @commands.command() - @override_in_channel(all_python_channels) - async def topic(self, ctx: commands.Context) -> None: - """Responds with a random topic to start a conversation, changing depending on channel.""" - try: - # Fetching topics. - channel_topics = py_topics[str(ctx.channel.id)] - - if channel_topics: - return await ctx.send(random.choice(channel_topics)) - - # If the channel ID doesn't have any topics. - else: - embed = Embed( - description=( - "No topics found for this Python channel. You can suggest new ideas for topics " - "[here](https://github.com/python-discord/seasonalbot/issues/426)!" - )) - - return await ctx.send(embed=embed) - - except KeyError: - # If the channel isn't Python. - await ctx.send(random.choice(starters['starters'])) - - -def setup(bot: commands.Bot) -> None: - """Conversation starters Cog load.""" - bot.add_cog(ConvoStarters(bot)) diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py new file mode 100644 index 00000000..f4d1d3ce --- /dev/null +++ b/bot/exts/evergreen/conversationstarters.py @@ -0,0 +1,57 @@ +import json +import logging +import random +from pathlib import Path + +from discord import Embed +from discord.ext import commands + +from bot.utils.decorators import override_in_channel + + +with Path("bot/resources/easter/starter.json").open("r", encoding="utf8") as f: + STARTERS = json.load(f)["starters"] + + +with Path("bot/resources/easter/py_topics.json").open("r", encoding="utf8") as f: + # First ID is #python-general and the rest are top to bottom categories of Topical Chat/Help. + PY_TOPICS = json.load(f)["python-channels"] + ALL_PYTHON_CHANNELS = [int(channel_id) for channel_id in PY_TOPICS.keys()] + + +class ConvoStarters(commands.Cog): + """Easter conversation topics.""" + + def __init__(self, bot: commands.Bot): + self.bot = bot + + @commands.command() + @override_in_channel(ALL_PYTHON_CHANNELS) + async def topic(self, ctx: commands.Context) -> None: + """Responds with a random topic to start a conversation, changing depending on channel.""" + try: + # Fetching topics. + channel_topics = PY_TOPICS[str(ctx.channel.id)] + + # If the channel isn't Python-related. + except KeyError: + await ctx.send(random.choice(starters['starters'])) + + # If the channel ID doesn't have any topics. + else: + if channel_topics: + await ctx.send(random.choice(channel_topics)) + + else: + embed = Embed( + description=( + "No topics found for this Python channel. You can suggest new ideas for topics " + "[here](https://github.com/python-discord/seasonalbot/issues/426)!" + )) + + await ctx.send(embed=embed) + + +def setup(bot: commands.Bot) -> None: + """Conversation starters Cog load.""" + bot.add_cog(ConvoStarters(bot)) -- cgit v1.2.3 From 0bcbe43557b9566f265d894b28c7f47a96765196 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 10 Aug 2020 13:08:38 -0700 Subject: Linted. --- bot/exts/evergreen/conversationstarters.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py index f4d1d3ce..54ed70c1 100644 --- a/bot/exts/evergreen/conversationstarters.py +++ b/bot/exts/evergreen/conversationstarters.py @@ -1,5 +1,4 @@ import json -import logging import random from pathlib import Path @@ -35,13 +34,13 @@ class ConvoStarters(commands.Cog): # If the channel isn't Python-related. except KeyError: - await ctx.send(random.choice(starters['starters'])) + await ctx.send(random.choice(STARTERS)) # If the channel ID doesn't have any topics. else: if channel_topics: await ctx.send(random.choice(channel_topics)) - + else: embed = Embed( description=( -- cgit v1.2.3 From 41f3d6fdbc2fc23f2d00a04392a00fc4736d801b Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 10 Aug 2020 13:48:46 -0700 Subject: Moved the resources to the correct folder for evergreen. --- bot/resources/easter/py_topics.json | 58 ---------------------------------- bot/resources/easter/starter.json | 24 -------------- bot/resources/evergreen/py_topics.json | 58 ++++++++++++++++++++++++++++++++++ bot/resources/evergreen/starter.json | 24 ++++++++++++++ 4 files changed, 82 insertions(+), 82 deletions(-) delete mode 100644 bot/resources/easter/py_topics.json delete mode 100644 bot/resources/easter/starter.json create mode 100644 bot/resources/evergreen/py_topics.json create mode 100644 bot/resources/evergreen/starter.json (limited to 'bot') diff --git a/bot/resources/easter/py_topics.json b/bot/resources/easter/py_topics.json deleted file mode 100644 index d1035b7a..00000000 --- a/bot/resources/easter/py_topics.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "python-channels": { - "267624335836053506": [ - "What's your favorite PEP?", - "What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python?", - "What functionality is your text editor/IDE missing for programming Python?", - "What parts of your life has Python automated, if any?" - ], - "630504881542791169": [ - - ], - "650401909852864553": [ - - ], - "342318764227821568": [ - - ], - "366673247892275221": [ - - ], - "343944376055103488": [ - - ], - "470884583684964352": [ - - ], - "660625198390837248": [ - - ], - "545603026732318730": [ - - ], - "716325106619777044": [ - - ], - "728390945384431688": [ - - ], - "366674035876167691": [ - - ], - "463035728335732738": [ - - ], - "463035462760792066": [ - - ], - "491523972836360192": [ - - ], - "338993628049571840": [ - - ], - "366673702533988363": [ - - ] - } -} diff --git a/bot/resources/easter/starter.json b/bot/resources/easter/starter.json deleted file mode 100644 index 31e2cbc9..00000000 --- a/bot/resources/easter/starter.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "starters": [ - "What is your favourite Easter candy or treat?", - "What is your earliest memory of Easter?", - "What is the title of the last book you read?", - "What is better: Milk, Dark or White chocolate?", - "What is your favourite holiday?", - "If you could have any superpower, what would it be?", - "Name one thing you like about a person to your right.", - "If you could be anyone else for one day, who would it be?", - "What Easter tradition do you enjoy most?", - "What is the best gift you've been given?", - "Name one famous person you would like to have at your easter dinner.", - "What was the last movie you saw in a cinema?", - "What is your favourite food?", - "If you could travel anywhere in the world, where would you go?", - "Tell us 5 things you do well.", - "What is your favourite place that you have visited?", - "What is your favourite color?", - "If you had $100 bill in your Easter Basket, what would you do with it?", - "What would you do if you know you could succeed at anything you chose to do?", - "If you could take only three things from your house, what would they be?" - ] -} diff --git a/bot/resources/evergreen/py_topics.json b/bot/resources/evergreen/py_topics.json new file mode 100644 index 00000000..d1035b7a --- /dev/null +++ b/bot/resources/evergreen/py_topics.json @@ -0,0 +1,58 @@ +{ + "python-channels": { + "267624335836053506": [ + "What's your favorite PEP?", + "What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python?", + "What functionality is your text editor/IDE missing for programming Python?", + "What parts of your life has Python automated, if any?" + ], + "630504881542791169": [ + + ], + "650401909852864553": [ + + ], + "342318764227821568": [ + + ], + "366673247892275221": [ + + ], + "343944376055103488": [ + + ], + "470884583684964352": [ + + ], + "660625198390837248": [ + + ], + "545603026732318730": [ + + ], + "716325106619777044": [ + + ], + "728390945384431688": [ + + ], + "366674035876167691": [ + + ], + "463035728335732738": [ + + ], + "463035462760792066": [ + + ], + "491523972836360192": [ + + ], + "338993628049571840": [ + + ], + "366673702533988363": [ + + ] + } +} diff --git a/bot/resources/evergreen/starter.json b/bot/resources/evergreen/starter.json new file mode 100644 index 00000000..31e2cbc9 --- /dev/null +++ b/bot/resources/evergreen/starter.json @@ -0,0 +1,24 @@ +{ + "starters": [ + "What is your favourite Easter candy or treat?", + "What is your earliest memory of Easter?", + "What is the title of the last book you read?", + "What is better: Milk, Dark or White chocolate?", + "What is your favourite holiday?", + "If you could have any superpower, what would it be?", + "Name one thing you like about a person to your right.", + "If you could be anyone else for one day, who would it be?", + "What Easter tradition do you enjoy most?", + "What is the best gift you've been given?", + "Name one famous person you would like to have at your easter dinner.", + "What was the last movie you saw in a cinema?", + "What is your favourite food?", + "If you could travel anywhere in the world, where would you go?", + "Tell us 5 things you do well.", + "What is your favourite place that you have visited?", + "What is your favourite color?", + "If you had $100 bill in your Easter Basket, what would you do with it?", + "What would you do if you know you could succeed at anything you chose to do?", + "If you could take only three things from your house, what would they be?" + ] +} -- cgit v1.2.3 From 3317f00e7dcd7fee1bda79fd5b82f2d9fbd2e1cc Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 10 Aug 2020 13:50:10 -0700 Subject: Finalized whitelist for allowed channels .topic can be used in. Changed resource path to evergreen, added WHITELISTED_CHANNELS to PY_TOPICS channels. --- bot/exts/evergreen/conversationstarters.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py index 54ed70c1..4df3f068 100644 --- a/bot/exts/evergreen/conversationstarters.py +++ b/bot/exts/evergreen/conversationstarters.py @@ -6,28 +6,36 @@ from discord import Embed from discord.ext import commands from bot.utils.decorators import override_in_channel +from bot.constants import WHITELISTED_CHANNELS -with Path("bot/resources/easter/starter.json").open("r", encoding="utf8") as f: +with Path("bot/resources/evergreen/starter.json").open("r", encoding="utf8") as f: STARTERS = json.load(f)["starters"] -with Path("bot/resources/easter/py_topics.json").open("r", encoding="utf8") as f: +with Path("bot/resources/evergreen/py_topics.json").open("r", encoding="utf8") as f: # First ID is #python-general and the rest are top to bottom categories of Topical Chat/Help. PY_TOPICS = json.load(f)["python-channels"] - ALL_PYTHON_CHANNELS = [int(channel_id) for channel_id in PY_TOPICS.keys()] + + # All the allowed channels that the ".topic" command is allowed to be executed in. + ALL_ALLOWED_CHANNELS = [int(channel_id) for channel_id in PY_TOPICS.keys()].extend(WHITELISTED_CHANNELS) class ConvoStarters(commands.Cog): - """Easter conversation topics.""" + """Evergreen conversation topics.""" def __init__(self, bot: commands.Bot): self.bot = bot @commands.command() - @override_in_channel(ALL_PYTHON_CHANNELS) + @override_in_channel(ALL_ALLOWED_CHANNELS) async def topic(self, ctx: commands.Context) -> None: - """Responds with a random topic to start a conversation, changing depending on channel.""" + """Responds with a random topic to start a conversation + + If in a Python channel, a python-related topic will be given. + + Otherwise, a random conversation topic will be recieved by the user. + """ try: # Fetching topics. channel_topics = PY_TOPICS[str(ctx.channel.id)] -- cgit v1.2.3 From 77cafe8a048bfaca2b1defcedb55761acfd6f5fc Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 10 Aug 2020 13:51:51 -0700 Subject: Linted. --- bot/exts/evergreen/conversationstarters.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py index 4df3f068..974a361e 100644 --- a/bot/exts/evergreen/conversationstarters.py +++ b/bot/exts/evergreen/conversationstarters.py @@ -5,8 +5,8 @@ from pathlib import Path from discord import Embed from discord.ext import commands -from bot.utils.decorators import override_in_channel from bot.constants import WHITELISTED_CHANNELS +from bot.utils.decorators import override_in_channel with Path("bot/resources/evergreen/starter.json").open("r", encoding="utf8") as f: @@ -30,8 +30,9 @@ class ConvoStarters(commands.Cog): @commands.command() @override_in_channel(ALL_ALLOWED_CHANNELS) async def topic(self, ctx: commands.Context) -> None: - """Responds with a random topic to start a conversation - + """ + Responds with a random topic to start a conversation. + If in a Python channel, a python-related topic will be given. Otherwise, a random conversation topic will be recieved by the user. -- cgit v1.2.3 From 141e82af3b5506135a60de8608ec96cc11739097 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 10 Aug 2020 14:18:42 -0700 Subject: ALL_ALLOWED_CHANNELS now is a list of channel IDs instead of None. --- bot/exts/evergreen/conversationstarters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py index 974a361e..8a07eea2 100644 --- a/bot/exts/evergreen/conversationstarters.py +++ b/bot/exts/evergreen/conversationstarters.py @@ -18,7 +18,7 @@ with Path("bot/resources/evergreen/py_topics.json").open("r", encoding="utf8") a PY_TOPICS = json.load(f)["python-channels"] # All the allowed channels that the ".topic" command is allowed to be executed in. - ALL_ALLOWED_CHANNELS = [int(channel_id) for channel_id in PY_TOPICS.keys()].extend(WHITELISTED_CHANNELS) + ALL_ALLOWED_CHANNELS = [int(channel_id) for channel_id in PY_TOPICS.keys()] + list(WHITELISTED_CHANNELS) class ConvoStarters(commands.Cog): -- cgit v1.2.3 From df51b8c11a3a42ae13dd00d8b994d5f1d70638e7 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 10 Aug 2020 14:31:11 -0700 Subject: Gave the Embed the burple color. --- bot/exts/evergreen/conversationstarters.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py index 8a07eea2..179fe478 100644 --- a/bot/exts/evergreen/conversationstarters.py +++ b/bot/exts/evergreen/conversationstarters.py @@ -2,7 +2,7 @@ import json import random from pathlib import Path -from discord import Embed +from discord import Color, Embed from discord.ext import commands from bot.constants import WHITELISTED_CHANNELS @@ -55,7 +55,9 @@ class ConvoStarters(commands.Cog): description=( "No topics found for this Python channel. You can suggest new ideas for topics " "[here](https://github.com/python-discord/seasonalbot/issues/426)!" - )) + ), + color=Color.blurple + ) await ctx.send(embed=embed) -- cgit v1.2.3 From 1c50a8180809561413ef5cfe73fc0fbc770f8fdc Mon Sep 17 00:00:00 2001 From: Xithrius <15021300+Xithrius@users.noreply.github.com> Date: Mon, 10 Aug 2020 14:43:53 -0700 Subject: Update bot/exts/evergreen/conversationstarters.py Co-authored-by: Dennis Pham --- bot/exts/evergreen/conversationstarters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py index 179fe478..757ec059 100644 --- a/bot/exts/evergreen/conversationstarters.py +++ b/bot/exts/evergreen/conversationstarters.py @@ -56,7 +56,7 @@ class ConvoStarters(commands.Cog): "No topics found for this Python channel. You can suggest new ideas for topics " "[here](https://github.com/python-discord/seasonalbot/issues/426)!" ), - color=Color.blurple + color=Color.blurple() ) await ctx.send(embed=embed) -- cgit v1.2.3 From f489a87f7f1d66983b1e495427883837c57332fe Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 17 Aug 2020 03:16:10 -0700 Subject: Changed from json to yaml config so comments can be included. --- bot/resources/evergreen/py_topics.json | 58 --------------------------- bot/resources/evergreen/py_topics.yaml | 73 ++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 58 deletions(-) delete mode 100644 bot/resources/evergreen/py_topics.json create mode 100644 bot/resources/evergreen/py_topics.yaml (limited to 'bot') diff --git a/bot/resources/evergreen/py_topics.json b/bot/resources/evergreen/py_topics.json deleted file mode 100644 index d1035b7a..00000000 --- a/bot/resources/evergreen/py_topics.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "python-channels": { - "267624335836053506": [ - "What's your favorite PEP?", - "What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python?", - "What functionality is your text editor/IDE missing for programming Python?", - "What parts of your life has Python automated, if any?" - ], - "630504881542791169": [ - - ], - "650401909852864553": [ - - ], - "342318764227821568": [ - - ], - "366673247892275221": [ - - ], - "343944376055103488": [ - - ], - "470884583684964352": [ - - ], - "660625198390837248": [ - - ], - "545603026732318730": [ - - ], - "716325106619777044": [ - - ], - "728390945384431688": [ - - ], - "366674035876167691": [ - - ], - "463035728335732738": [ - - ], - "463035462760792066": [ - - ], - "491523972836360192": [ - - ], - "338993628049571840": [ - - ], - "366673702533988363": [ - - ] - } -} diff --git a/bot/resources/evergreen/py_topics.yaml b/bot/resources/evergreen/py_topics.yaml new file mode 100644 index 00000000..f67ce4d6 --- /dev/null +++ b/bot/resources/evergreen/py_topics.yaml @@ -0,0 +1,73 @@ +# Conversation starters for python-related channels. + +# python-general +# 267624335836053506: +476190141161930755: + - What's your favorite PEP? + - What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python? + - What functionality is your text editor/IDE missing for programming Python? + - What parts of your life has Python automated, if any? + +# async +630504881542791169: + - + +# computer-science +650401909852864553: + - + +# databases +342318764227821568: + - + +# data-science +366673247892275221: + - + +# discord.py +343944376055103488: + - + +# esoteric-python +470884583684964352: + - + +# game-development +660625198390837248: + - + +# microcontrollers +545603026732318730: + - + +# networking +716325106619777044: + - + +# python-extensions +728390945384431688: + - + +# security +366674035876167691: + - + +# software-testing +463035728335732738: + - + +# tools-and-devops +463035462760792066: + - + +# unix +491523972836360192: + - + +# user-interfaces +338993628049571840: + - + +# web-development +366673702533988363: + - -- cgit v1.2.3 From b7779d9af8aaf207252a6adb8a6f2214f6c2ed16 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 17 Aug 2020 03:18:15 -0700 Subject: Changed from json to yaml extraction of channel topics. --- bot/exts/evergreen/conversationstarters.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py index 757ec059..c559c2f8 100644 --- a/bot/exts/evergreen/conversationstarters.py +++ b/bot/exts/evergreen/conversationstarters.py @@ -1,4 +1,5 @@ import json +import yaml import random from pathlib import Path @@ -13,12 +14,15 @@ with Path("bot/resources/evergreen/starter.json").open("r", encoding="utf8") as STARTERS = json.load(f)["starters"] -with Path("bot/resources/evergreen/py_topics.json").open("r", encoding="utf8") as f: +with Path("bot/resources/evergreen/py_topics.yaml").open("r", encoding="utf8") as f: # First ID is #python-general and the rest are top to bottom categories of Topical Chat/Help. - PY_TOPICS = json.load(f)["python-channels"] + PY_TOPICS = yaml.load(f, Loader=yaml.FullLoader) + + # Removing `None` from lists of topics, if not a list, it is changed to an empty one. + PY_TOPICS = {k: [i for i in v if i] if isinstance(v, list) else [] for k, v in PY_TOPICS.items()} # All the allowed channels that the ".topic" command is allowed to be executed in. - ALL_ALLOWED_CHANNELS = [int(channel_id) for channel_id in PY_TOPICS.keys()] + list(WHITELISTED_CHANNELS) + ALL_ALLOWED_CHANNELS = [channel_id for channel_id in PY_TOPICS.keys()] + list(WHITELISTED_CHANNELS) class ConvoStarters(commands.Cog): @@ -39,7 +43,7 @@ class ConvoStarters(commands.Cog): """ try: # Fetching topics. - channel_topics = PY_TOPICS[str(ctx.channel.id)] + channel_topics = PY_TOPICS[ctx.channel.id] # If the channel isn't Python-related. except KeyError: -- cgit v1.2.3 From 3f3f713da2f72b54e095bbc2d5a39198b45ee6f8 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 17 Aug 2020 03:16:10 -0700 Subject: Revert "Changed from json to yaml config so comments can be included." This reverts commit f489a87f7f1d66983b1e495427883837c57332fe. --- bot/resources/evergreen/py_topics.json | 58 +++++++++++++++++++++++++++ bot/resources/evergreen/py_topics.yaml | 73 ---------------------------------- 2 files changed, 58 insertions(+), 73 deletions(-) create mode 100644 bot/resources/evergreen/py_topics.json delete mode 100644 bot/resources/evergreen/py_topics.yaml (limited to 'bot') diff --git a/bot/resources/evergreen/py_topics.json b/bot/resources/evergreen/py_topics.json new file mode 100644 index 00000000..d1035b7a --- /dev/null +++ b/bot/resources/evergreen/py_topics.json @@ -0,0 +1,58 @@ +{ + "python-channels": { + "267624335836053506": [ + "What's your favorite PEP?", + "What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python?", + "What functionality is your text editor/IDE missing for programming Python?", + "What parts of your life has Python automated, if any?" + ], + "630504881542791169": [ + + ], + "650401909852864553": [ + + ], + "342318764227821568": [ + + ], + "366673247892275221": [ + + ], + "343944376055103488": [ + + ], + "470884583684964352": [ + + ], + "660625198390837248": [ + + ], + "545603026732318730": [ + + ], + "716325106619777044": [ + + ], + "728390945384431688": [ + + ], + "366674035876167691": [ + + ], + "463035728335732738": [ + + ], + "463035462760792066": [ + + ], + "491523972836360192": [ + + ], + "338993628049571840": [ + + ], + "366673702533988363": [ + + ] + } +} diff --git a/bot/resources/evergreen/py_topics.yaml b/bot/resources/evergreen/py_topics.yaml deleted file mode 100644 index f67ce4d6..00000000 --- a/bot/resources/evergreen/py_topics.yaml +++ /dev/null @@ -1,73 +0,0 @@ -# Conversation starters for python-related channels. - -# python-general -# 267624335836053506: -476190141161930755: - - What's your favorite PEP? - - What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python? - - What functionality is your text editor/IDE missing for programming Python? - - What parts of your life has Python automated, if any? - -# async -630504881542791169: - - - -# computer-science -650401909852864553: - - - -# databases -342318764227821568: - - - -# data-science -366673247892275221: - - - -# discord.py -343944376055103488: - - - -# esoteric-python -470884583684964352: - - - -# game-development -660625198390837248: - - - -# microcontrollers -545603026732318730: - - - -# networking -716325106619777044: - - - -# python-extensions -728390945384431688: - - - -# security -366674035876167691: - - - -# software-testing -463035728335732738: - - - -# tools-and-devops -463035462760792066: - - - -# unix -491523972836360192: - - - -# user-interfaces -338993628049571840: - - - -# web-development -366673702533988363: - - -- cgit v1.2.3 From 9c994c23f946f13202eb791d42cc22fdaa60912c Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 17 Aug 2020 03:21:55 -0700 Subject: Auto stash before revert of "Changed from json to yaml config so comments can be included." --- bot/resources/evergreen/py_topics.yaml | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 bot/resources/evergreen/py_topics.yaml (limited to 'bot') diff --git a/bot/resources/evergreen/py_topics.yaml b/bot/resources/evergreen/py_topics.yaml new file mode 100644 index 00000000..49cf38b5 --- /dev/null +++ b/bot/resources/evergreen/py_topics.yaml @@ -0,0 +1,72 @@ +# Conversation starters for python-related channels. + +# python-general +267624335836053506: + - What's your favorite PEP? + - What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python? + - What functionality is your text editor/IDE missing for programming Python? + - What parts of your life has Python automated, if any? + +# async +630504881542791169: + - + +# computer-science +650401909852864553: + - + +# databases +342318764227821568: + - + +# data-science +366673247892275221: + - + +# discord.py +343944376055103488: + - + +# esoteric-python +470884583684964352: + - + +# game-development +660625198390837248: + - + +# microcontrollers +545603026732318730: + - + +# networking +716325106619777044: + - + +# python-extensions +728390945384431688: + - + +# security +366674035876167691: + - + +# software-testing +463035728335732738: + - + +# tools-and-devops +463035462760792066: + - + +# unix +491523972836360192: + - + +# user-interfaces +338993628049571840: + - + +# web-development +366673702533988363: + - -- cgit v1.2.3 From 809a4458e418d15288749c69b061990b6b737716 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Mon, 17 Aug 2020 03:36:57 -0700 Subject: Sorted imports to comply with flake8 standards. --- bot/exts/evergreen/conversationstarters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py index c559c2f8..cfa8dbce 100644 --- a/bot/exts/evergreen/conversationstarters.py +++ b/bot/exts/evergreen/conversationstarters.py @@ -1,8 +1,8 @@ import json -import yaml import random from pathlib import Path +import yaml from discord import Color, Embed from discord.ext import commands -- cgit v1.2.3 From cb2eca7c5d4120006712fe2d7cf35988c6f8e024 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Fri, 21 Aug 2020 18:33:44 -0700 Subject: Added topics to py_topics.yaml, removed the json form of this file. --- bot/resources/evergreen/py_topics.json | 58 ---------------------------------- bot/resources/evergreen/py_topics.yaml | 21 +++++++++--- 2 files changed, 16 insertions(+), 63 deletions(-) delete mode 100644 bot/resources/evergreen/py_topics.json (limited to 'bot') diff --git a/bot/resources/evergreen/py_topics.json b/bot/resources/evergreen/py_topics.json deleted file mode 100644 index d1035b7a..00000000 --- a/bot/resources/evergreen/py_topics.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "python-channels": { - "267624335836053506": [ - "What's your favorite PEP?", - "What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python?", - "What functionality is your text editor/IDE missing for programming Python?", - "What parts of your life has Python automated, if any?" - ], - "630504881542791169": [ - - ], - "650401909852864553": [ - - ], - "342318764227821568": [ - - ], - "366673247892275221": [ - - ], - "343944376055103488": [ - - ], - "470884583684964352": [ - - ], - "660625198390837248": [ - - ], - "545603026732318730": [ - - ], - "716325106619777044": [ - - ], - "728390945384431688": [ - - ], - "366674035876167691": [ - - ], - "463035728335732738": [ - - ], - "463035462760792066": [ - - ], - "491523972836360192": [ - - ], - "338993628049571840": [ - - ], - "366673702533988363": [ - - ] - } -} diff --git a/bot/resources/evergreen/py_topics.yaml b/bot/resources/evergreen/py_topics.yaml index 49cf38b5..5a2e8d89 100644 --- a/bot/resources/evergreen/py_topics.yaml +++ b/bot/resources/evergreen/py_topics.yaml @@ -6,10 +6,16 @@ - What's your current text editor/IDE, and what functionality do you like about it the most when programming in Python? - What functionality is your text editor/IDE missing for programming Python? - What parts of your life has Python automated, if any? + - Which python project are you the most proud of making? + - What made you want to learn Python? + - When did you start learning Python? + - What reasons are you learning Python for? + - Where's the strangest place you've seen Python? + - How has learning Python changed your life? # async 630504881542791169: - - + - Are there any frameworks you wish were async? # computer-science 650401909852864553: @@ -17,7 +23,7 @@ # databases 342318764227821568: - - + - Where do you get your best data? # data-science 366673247892275221: @@ -25,11 +31,15 @@ # discord.py 343944376055103488: - - + - What unique features does your bot contain, if any? + - What commands/features are you proud of making? + - What feature would you be the most interested in making? + - What feature would you like to see added to the library? what feature in the library do you think is redundant? + - Do you think there's a way in which Discord could handle bots better? # esoteric-python 470884583684964352: - - + - What's a common part of programming we can make harder? # game-development 660625198390837248: @@ -57,7 +67,8 @@ # tools-and-devops 463035462760792066: - - + - What editor would you recommend to a beginner? Why? + - What editor would you recommend to be the most efficient? Why? # unix 491523972836360192: -- cgit v1.2.3 From c25dbfc87e7822bf14cf9b34eb7602dc511d6a68 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Sun, 23 Aug 2020 06:20:30 -0700 Subject: Added one more topic to #async. --- bot/resources/evergreen/py_topics.yaml | 1 + 1 file changed, 1 insertion(+) (limited to 'bot') diff --git a/bot/resources/evergreen/py_topics.yaml b/bot/resources/evergreen/py_topics.yaml index 5a2e8d89..ae5289a7 100644 --- a/bot/resources/evergreen/py_topics.yaml +++ b/bot/resources/evergreen/py_topics.yaml @@ -16,6 +16,7 @@ # async 630504881542791169: - Are there any frameworks you wish were async? + - How have coroutines changed the way you write Python? # computer-science 650401909852864553: -- cgit v1.2.3