diff --git a/welcomeCog/info.json b/welcomeCog/info.json index 605d4b1..f3a31ad 100644 --- a/welcomeCog/info.json +++ b/welcomeCog/info.json @@ -6,7 +6,7 @@ "name": "Welcome", "short": "Sends a welcome dm thats written in a specific format to the users", "description": "Sends a welcome dm thats written in a specific format to the users", - "requirements": ["requests"], + "requirements": [], "tags": [ "welcome" ] diff --git a/welcomeCog/welcome.py b/welcomeCog/welcome.py index f15bd00..bb03751 100644 --- a/welcomeCog/welcome.py +++ b/welcomeCog/welcome.py @@ -5,7 +5,40 @@ import json from redbot.core import Config, checks, commands from redbot.core.utils.chat_formatting import box, humanize_list, pagify -jsonFilePath = 'embedded_message.json' +jsonFile = '''\ +{\ + "title":"Welcome to the Kanium Discord!",\ + "description":[\ + "\n",\ + "Please ensure to have a look at our #public_info channel and understand who we are and how this place works.",\ + "\n\n",\ + "Additionally it must be mentioned that being on our Discord and playing games with us, does not require Kanium membership. We,",\ + "on the other hand, expect that those who seek to apply for membership show earnestness- in both application and in becoming part of the community"\ + ],\ + "color":"0x3399ff",\ + "thumbnail": "https://i.imgur.com/4TLdfDA.png",\ + "fields":[\ + {"id":"text", "name":"Apply to join Kanuim", "value":"!apply applicationText", "inline":"True"},\ + {"id":"text", "name":"Description", "value":"Use this to submit an application for joining Kanium", "inline":"True"},\ + {"id":"text", "name":"Enjoy your stay", "value":"Feel free to hang out in the chat rooms. If you're looking to play a specific game, join that game's chat channel", "inline":"False"},\ + {"id":"links", "name":"Useful information", "value":[ \ + "\n",\ + "[KANIUM Website](https://www.kanium.org/)",\ + "\n", + "[KANIUM Steam Group](https://steamcommunity.com/groups/Kanium)",\ + "\n", + "[KANIUM Twitch Channel](https://twitch.tv/kaniumtv)",\ + "\n", + "[KANIUM Open Collective](https://opencollective.com/kanium)"\ + ], "inline":"True"}, + {"id":"text", "name":"Apply to join Kanuim", "value":"!apply applicationText", "inline":"True"}\ + ],\ + "footer":{\ + "text":"If you have any questions, please ping a @Recruiter",\ + "icon_url":"https://i.imgur.com/4TLdfDA.png"\ + }\ +}\ +''' def fetchMessage(jsonFormat): try: @@ -28,15 +61,12 @@ def fetchMessage(jsonFormat): class WelcomeCog(commands.Cog): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.message = json.load(open(jsonFilePath,'r')) + self.message = json.loads(jsonFile) @commands.Cog.listener() async def on_member_join(self, member: discord.Member): - #try: - # message = fetchMessage(self.message) - # await member.send(content=None, embed=message) - message = 'helloo' - await member.send(message) - # except (discord.NotFound, discord.Forbidden): - # print( - # f'Error Occured! sending a dm to {member.display_name} didnt work !') + try: + message = fetchMessage(self.message) + await member.send(content=None, embed=message) + except (discord.NotFound, discord.Forbidden): + print(f'Error Occured! sending a dm to {member.display_name} didnt work !')