Skip to content

Commit

Permalink
Join leave msgs now works only for the GUILD; resolve typo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bth123 committed Sep 23, 2024
1 parent 36bf23e commit 47e94fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions cogs/general/join_leave_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from random import choice
import io

from settings import LEAVES_CHANNEL_ID, JOINS_CHANNEL_ID
from settings import LEAVES_CHANNEL_ID, JOINS_CHANNEL_ID, GUILD


async def generate_banner(user):
Expand Down Expand Up @@ -42,7 +42,9 @@ def __init__(self, bot):
self.bot = bot

@commands.Cog.listener("on_member_join")
async def on_member_join(self, user):
async def on_member_join(self, member):
if member.guild_id != GUILD:
return
greeting_msg = choice([
"Добро пожаловать, {0}. Мы надеемся, что ты принёс пиццу",
"Добро пожаловать, {0}!",
Expand All @@ -55,12 +57,14 @@ async def on_member_join(self, user):
"О найс, {0} присоединился",
"Привет, {0}! У тебя есть датапаки? 😏"
])
greeting_image = await generate_banner(user)
greeting_image = await generate_banner(member)
JOINS_CHANNEL = await self.bot.fetch_channel(JOINS_CHANNEL_ID)
await JOINS_CHANNEL.send(greeting_msg.format(user.mention), file=greeting_image)
await JOINS_CHANNEL.send(greeting_msg.format(member.mention), file=greeting_image)

@commands.Cog.listener("on_raw_member_remove")
async def on_raw_member_remove(self, payload):
if payload.guild_id != GUILD:
return
user = payload.user
leaving_msg = choice([
"{0} кудааа",
Expand Down
2 changes: 1 addition & 1 deletion cogs/help/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def resolve(self, ctx, solution: str=None, *, helpers: str="None"):
raise Exception("Channel is not help forum")
elif ctx.author != ctx.channel.owner and not is_moderator:
raise Exception("User not author/op")
elif solution == None and not ctx.message.refernce:
elif solution == None and not ctx.message.reference:
embed = discord.Embed(title="🤨 Погодите, вы уверены?", color=no_color,
description=f"{Emojis.exclamation_mark} Вы не указали ни сообщение, ни "
"людей которые помогли решить проблему, это заархивирует ветку без решения")
Expand Down

0 comments on commit 47e94fd

Please sign in to comment.