Skip to content

Commit

Permalink
attempt to add the gh snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
dariagrudzien committed Sep 26, 2023
1 parent a650d69 commit 78fe480
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
7 changes: 3 additions & 4 deletions juniorguru_chick/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,12 @@ async def handle_intro_thread(starting_message: discord.Message, thread: discord
emojis = intro.choose_intro_emojis(starting_message.content)
logger.info(f"Processing thread {thread.name!r} (reacting with {emojis!r} and more…)")
tasks = [ensure_thread_name(thread, intro.THREAD_NAME_TEMPLATE),
manage_intro_thread(thread)]
manage_intro_thread(thread, starting_message.content)]
tasks.extend([starting_message.add_reaction(emoji) for emoji in emojis])
await asyncio.gather(*tasks)


async def manage_intro_thread(thread: discord.Thread):
await thread.send(**intro.generate_intro_message())
async def manage_intro_thread(thread: discord.Thread, starting_message: str):
await thread.send(**intro.generate_intro_message(starting_message))
await add_members_with_role(thread, intro.GREETER_ROLE_ID)


Expand Down
25 changes: 24 additions & 1 deletion juniorguru_chick/lib/intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def choose_intro_emojis(intro_message_content: str) -> list[str]:
return ["👋", "🐣", "👍"] + list(emojis)


def generate_intro_message() -> dict[str, Any]:
def generate_intro_message(intro_message_content: str) -> dict[str, Any]:
content = (
'Píp, píp! Tady kuře, místní robot. '
'Vítej v klubu 👋'
Expand All @@ -75,10 +75,33 @@ def generate_intro_message() -> dict[str, Any]:
'- Záznamy přednášek? <#788822884948770846>\n'
'- Něco jiného? <#769966887055392768> snese cokoliv\n'
'- Nevíš, jak to tady funguje? Ptej se v <#806215364379148348>'
)

# TODO - replace with Czech version and reformat the string
gh_connection_snippet = """
'\n\n'
It looks like you've mentioned your GitHub profile in your intro message.
Would you like to connect your GitHub account to your Discord account? This will allow you to get a special role and access to a private channel. So very fun!
Here's how to do it:
1. Go to Discord settings.
2. Navigate to Connections.
3. Click on GitHub.
4. Authorize the connection.
If you have any questions, feel free to ask in the #ahoj channel. We're here to help!
"""

if intro_message_content.find("github.com/") == True:
content = content + gh_connection_snippet

footer = (
'\n\n'
'A nezapomeň, že junior.guru není jenom klub. '
'Tady aspoň dva odkazy, které fakt nechceš minout: '
)

content = content + footer
view = ui.View(ui.Button(emoji='📖',
label='Příručka',
url='https://junior.guru/handbook/',
Expand Down

0 comments on commit 78fe480

Please sign in to comment.