|
@@ -16,20 +16,16 @@ class Bot(commands.Bot):
|
|
|
|
|
|
name = str()
|
|
|
last_seen_dict = dict()
|
|
|
- ogey_of_day_dict = dict()
|
|
|
|
|
|
#Инициализация бота
|
|
|
def __init__(self, name):
|
|
|
self.name = name
|
|
|
tmpfile = load_obj(self.name + '_last_seen_dict')
|
|
|
if tmpfile: self.last_seen_dict = tmpfile
|
|
|
- tmpfile = load_obj(self.name + '_ogey_of_day')
|
|
|
- if tmpfile: self.ogey_of_day_dict = tmpfile
|
|
|
super().__init__(token=ACCESS_TOKEN, prefix=PREFIX, initial_channels=INITIAL_CHANNELS)
|
|
|
|
|
|
def save_objects(self):
|
|
|
save_obj(self.last_seen_dict, self.name + '_last_seen_dict')
|
|
|
- save_obj(self.ogey_of_day_dict, self.name + '_ogey_of_day')
|
|
|
|
|
|
#Событие готовности бота
|
|
|
async def event_ready(self):
|
|
@@ -54,7 +50,7 @@ class Bot(commands.Bot):
|
|
|
#Приветствия и покатствия
|
|
|
check_str = re.split(r',|!|;|\.|\?', message.content)[0]
|
|
|
cust_com = custom_commands_with_tag.get(str(check_str.lower()))
|
|
|
- if cust_com and message.channel.name in ALLOW_FLOOD:
|
|
|
+ if cust_com and message.channel.name:
|
|
|
await message.channel.send(f'@{message.author.name}, {random.choice(cust_com)}')
|
|
|
return
|
|
|
|
|
@@ -91,6 +87,12 @@ class Bot(commands.Bot):
|
|
|
if(not msg == None):
|
|
|
await ctx.send(msg)
|
|
|
|
|
|
+ @commands.command(name='мем', aliases=['меме', 'meme'])
|
|
|
+ async def meme(self, ctx: commands.Context):
|
|
|
+ msg = memes.get(ctx.channel.name)
|
|
|
+ if(not msg == None):
|
|
|
+ await ctx.send(msg)
|
|
|
+
|
|
|
@commands.command(name='смайлы', aliases=['7tv', 'smiles', 'emoji', 'смайлики', 'эмоуты'])
|
|
|
async def SpecialSmiles(self, ctx: commands.Context):
|
|
|
if ctx.channel.name in ALLOW_URL:
|
|
@@ -129,16 +131,6 @@ class Bot(commands.Bot):
|
|
|
async def whatdaytoday(self, ctx: commands.Context):
|
|
|
await ctx.send(f'@{ctx.author.name}, {GetTodayHoliday()}')
|
|
|
|
|
|
- @commands.cooldown(rate=1, per=60, bucket=commands.Bucket.channel)
|
|
|
- @commands.command(name='ogeyofday')
|
|
|
- async def ogey_of_day_command(self, ctx: commands.Context):
|
|
|
- if ctx.channel.name not in OgeyOfHourChannels:
|
|
|
- return
|
|
|
- if ctx.channel.name in self.ogey_of_day_dict:
|
|
|
- await ctx.send(f'@{ctx.author.name}, Ogey дня сегодня {self.ogey_of_day_dict[ctx.channel.name]}, можно только позавидовать этому чатеру EZ Clap')
|
|
|
- else:
|
|
|
- await ctx.send(f'@{ctx.author.name}, Ogey дня не определен PoroSad')
|
|
|
-
|
|
|
#Команды под оффлайн чат
|
|
|
@commands.cooldown(rate=1, per=10, bucket=commands.Bucket.member)
|
|
|
@commands.command(name='чмок')
|
|
@@ -187,15 +179,6 @@ class Bot(commands.Bot):
|
|
|
return
|
|
|
await ctx.send(GetRandAnek())
|
|
|
|
|
|
-
|
|
|
- #Рутины
|
|
|
- @routines.routine(time = datetime.datetime(year = 2023, month = 6, day = 5, hour = 19, minute = 30))
|
|
|
- async def ogey_of_day_routine(self):
|
|
|
- for ch in OgeyOfHourChannels:
|
|
|
- channel = self.get_channel(ch)
|
|
|
- self.ogey_of_day_dict[ch] = random.choice(tuple(channel.chatters)).name
|
|
|
- await channel.send(f'Ogey дня становится @{self.ogey_of_day_dict[ch]}. Похлопаем ему EZ Clap')
|
|
|
-
|
|
|
#Команды для белого списка
|
|
|
@commands.command(name='горячесть', aliases=['температура', 'темп', 'temp'])
|
|
|
async def temperature(self, ctx: commands.Context):
|
|
@@ -216,10 +199,6 @@ class Bot(commands.Bot):
|
|
|
await channel.send(f'@{user.name}, привет стример! 😘')
|
|
|
self.last_seen_dict[user.name] = datetime.datetime.now()
|
|
|
print(f'{datetime.datetime.now()}: Стример в чате {user.name}')
|
|
|
-
|
|
|
- async def event_ready(self):
|
|
|
- #Старт рутин
|
|
|
- self.ogey_of_day_routine.start()
|
|
|
|
|
|
#Дополнительные функции
|
|
|
async def is_stream_online(self, channel) -> bool:
|