def sendurl(m): config.about(m, bot) try: if m.from_user.id != 441399484: return user = users.find_one({'id':m.from_user.id}) kb = types.InlineKeyboardMarkup() for ids in user['url_buttons']: kb.add(types.InlineKeyboardButton(text = ids[0], url = ids[1])) i = 0 if user['gif'] == None: for ids in idgroup.find({}): try: bot.send_message(ids['id'], m.text.split('#^')[1], parse_mode = 'markdown', reply_markup = kb) i+=1 except: pass bot.send_message(m.chat.id, '#рассылка получили сообщение '+str(i)+' чатов!') else: for ids in idgroup.find({}): try: bot.send_document(ids['id'], user['gif'], caption = m.text.split('#^')[1], parse_mode = 'markdown', reply_markup = kb) i+=1 except: pass bot.send_message(m.chat.id, '#рассылка получили сообщение '+str(i)+' чатов!') except: bot.send_message(m.chat.id, traceback.format_exc())
def dailyr(m): config.about(m, bot) try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) if m.from_user.id!=m.chat.id: x=idgroup.find_one({'id':m.chat.id}) if x!=None: p=0 for ids in x['topdaily']: try: if x['topdaily'][ids]['id']==m.from_user.id: p=1 except: pass if p==0: idgroup.update_one({'id':m.chat.id},{'$set':{'topdaily.'+str(m.from_user.id):createdailyuser(m.from_user.id, m.from_user.first_name,m.from_user.username)}}) bot.send_message(m.chat.id, 'Вы успешно зарегистрировались!') else: bot.send_message(m.chat.id, 'Ты уже в игре!') else: bot.send_message(m.chat.id, "Сначала напишите в чат что-нибудь!") else: bot.send_message(m.chat.id, 'Можно регистрироваться только в группах!') except: pass
def name(m): config.about(m, bot) try: if m.text.lower()=='/name' or m.text.lower()=='/name@chlenomerbot': if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) player=iduser.find_one({'id':m.from_user.id}) if player!=None: x=m.text.split('/name ') if len(x)==2: if len(x[1])<=40: try: iduser.update_one({'id':m.from_user.id}, {'$set':{'pet.name':x[1]}}) bot.send_message(m.from_user.id, 'Вы успешно переименовали питомца!') except: bot.send_message(m.from_user.id, 'У вас нет питомца!') else: bot.send_message(m.from_user.id, 'Длина имени не должна превышать 40 символов!') else: bot.send_message(m.from_user.id, 'Неверный формат! Пишите в таком формате:\n'+'/name *имя*, где *имя* - имя вашего питомца.', parse_mode='markdown') else: bot.send_message(m.from_user.id, 'Сначала напишите боту "член" хотя бы один раз!') except: pass
def removedailyu(m): config.about(m, bot) try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) pass x=bot.get_chat_member(m.chat.id, m.from_user.id) if 'administrator' in x.status or 'creator' in x.status or m.from_user.id==441399484: chat=idgroup.find_one({'id':m.chat.id}) try: if len(m.text.split(' '))==2: user=chat['topdaily'][m.text.split(' ')[1]] if user['id']!=441399484: idgroup.update_one({'id':chat['id']},{'$set':{'topdaily.'+str(user['id']):{'name':user['name']}}}) bot.send_message(m.chat.id, 'Юзер был успешно удалён из списка!') else: bot.send_message(m.chat.id, 'Вы не можете удалить администратора бота из списка!') else: bot.send_message(m.chat.id, 'Чтобы удалить юзера из ежедневного розыгрыша, введите эту команду в таком формате:\n'+ '/removedailyuser *USERID*, где *USERID* - айди участника, которого вы хотите удалить. Взять его можно '+ 'по команде /id.\n\nВНИМАНИЕ!!!\nУдалив участника из списка, вы сбросите его чатовую статистику ежедневных '+ 'розыгрышей!',parse_mode='markdown') except: bot.send_message(m.chat.id, 'Юзер с таким id не регистрировался в этом чате!') else: bot.send_message(m.chat.id, 'Вы не админ чата!') except: bot.send_message(441399484, traceback.format_exc())
def biggest(m): config.about(m, bot) try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) if m.from_user.id!=m.chat.id: x=idgroup.find_one({'id':m.chat.id}) if x!=None: if x['dailyroll']==1: nmb=0 for zz in x['topdaily']: nmb+=1 if nmb>0: x['dailyroll']=0 idgroup.update_one({'id':m.chat.id},{'$set':{'dailyroll':0}}) bot.send_message(m.chat.id, 'Начинаю поиск по базе данных...') t=threading.Timer(2, turn2, args=[m.chat.id]) t.start() else: bot.send_message(m.chat.id, 'Нет ни одного зарегистрированного пользователя! Нажмите /dailychlenreg для того, '+ 'чтобы я добавил вас в список.') else: bot.send_message(m.chat.id, 'Сегодня уже был проведён розыгрыш! Со стояком был замечен:\n\n'+x['todaywinner']+'!') else: bot.send_message(m.chat.id, 'Сначала напишите в группу что-нибудь!') except: pass
def sendpiiic(m): config.about(m, bot) if m.from_user.id == 441399484: try: param = m.text.split(' ')[1] if param == 'users': x = iduser.find({}) elif param == 'groups': x = idgroup.find({}) a = iduser.find_one({'id':m.from_user.id}) ph = a['pic'] capti = m.text.split('/sendpic '+param+' ')[1] y=iduser.find({}) usend=0 gsend=0 for one in x: try: bot.send_photo(one['id'], ph, caption = capti) gsend+=1 except: pass # for one in y: # try: # bot.send_photo(one['id'], ph, caption = capti) # usend+=1 # except: # pass bot.send_message(441399484, 'Отправлено сообщений '+param+': '+str(gsend)) except: bot.send_message(441399484, traceback.format_exc())
def topchlen(m): config.about(m, bot) try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) x=idgroup.find_one({'id':m.chat.id}) if x!=None: text='' z=1 winlist=[] while z<11: winid=0 maxnumber=-1 da=0 for ids in x['topdaily']: try: if x['topdaily'][ids]['dailywins']>maxnumber and x['topdaily'][ids]['id'] not in winlist: da=1 winid=x['topdaily'][ids]['id'] maxnumber=x['topdaily'][ids]['dailywins'] except: pass if da==1: winlist.append(winid) text+=str(z)+'. '+x['topdaily'][str(winid)]['name']+': '+str(x['topdaily'][str(winid)]['dailywins'])+'\n' z+=1 if text=='': text='В этой группе не было проведено ни одного розыгрыша!' bot.send_message(m.chat.id, 'Топ-10 пользователей, чей член больше всего раз был замечен в стоячем состоянии:\n\n'+text) bot.send_message(441399484, 'Топ-10 пользователей, чей член больше всего раз был замечен в стоячем состоянии:\n\n'+text) except: pass
def counttt(m): config.about(m, bot) if m.from_user.id==441399484: global pods4et pods4et=1 t=threading.Timer(60, ends4et, args=[m.chat.id]) t.start() bot.send_message(m.chat.id, 'Считаю количество сообщений за минуту.')
def chatid(m): config.about(m, bot) try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) bot.send_message(m.chat.id, 'Айди чата: `'+str(m.chat.id)+'`', parse_mode='markdown') except: pass
def usecoins(m): config.about(m, bot) try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) bot.send_message(m.chat.id, '@petwarbot - тут можно подраться своим питомцем.') except: pass
def channel(message): try: m=message config.about(m, bot) if message.from_user.id not in ban: incmsg(message.from_user.id, message.chat.id, message.message_id) bot.send_message(message.chat.id, 'Канал обновлений: @chlenomer') except: pass
def donatemes(m): config.about(m, bot) return try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) bot.send_message(m.chat.id, ' вам нравится бот и вы хоти)', parse_mode='markdown') except: pass
def adddsfdgeh(m): config.about(m, bot) if m.from_user.id==441399484: try: id=int(m.text.split(' ')[1]) iduser.update_one({'id':id},{'$inc':{'chlenocoins':int(m.text.split(' ')[2])}}) bot.send_message(m.chat.id, 'Членокоины добавлены!') except: bot.send_message(441399484, traceback.format_exc())
def ticto(message): try: m=message config.about(m, bot) if message.from_user.id not in ban: incmsg(message.from_user.id, message.chat.id, message.message_id) bot.send_message(message.chat.id, 'Умеет менять размер члинуса') except: pass
def pethelp(m): config.about(m, bot) try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) bot.send_message(m.chat.id, '@petwarbot - бот для битвы питомцев.' ) except: pass
def cpiccc(m): config.about(m, bot) x = iduser.find_one({'id':m.from_user.id}) if x != None: if x['id'] == 441399484: try: pic = x['pic'] bot.send_photo(m.chat.id, pic) except: pass
def commessage(message): try: m=message config.about(m, bot) if m.text.lower()=='/commands' or m.text.lower()=='/commands@chlenomerbot': if message.from_user.id not in ban: incmsg(message.from_user.id, message.chat.id, message.message_id) bot.send_message(message.chat.id, 'Все фразы, связанные со словом "член"') except: pass
def addbutt(m): config.about(m, bot) if m.from_user.id != 441399484: return user = users.find_one({'id':m.from_user.id}) if 'url_buttons' not in user: users.update_one({'id':user['id']},{'$set':{'url_buttons':[]}}) user = users.find_one({'id':m.from_user.id}) users.update_one({'id':user['id']},{'$set':{'url_buttons':[]}}) bot.send_message(m.chat.id, 'cleared')
def startms(message): try: m=message config.about(m, bot) if m.text.lower()=='/start' or m.text.lower()=='/start@chlenomerbot': if message.from_user.id not in ban: incmsg(message.from_user.id, message.chat.id, message.message_id) if message.from_user.id==message.chat.id: bot.send_message(message.from_user.id, 'Если ты здесь, то ты наверняка хочешь измерить член! Пиши /commands, чтобы узнать, на какие слова реагирует бот') except: pass
def combine(m): config.about(m, bot) if m.from_user.id==441399484: try: x1=int(m.text.split(' ')[1]) x2=int(m.text.split(' ')[2]) iduser.update_one({'id':x2},{'$inc':{'summ':iduser.find_one({'id':x1})['summ']}}) iduser.update_one({'id':x2},{'$inc':{'kolvo':iduser.find_one({'id':x1})['kolvo']}}) bot.send_message(x2, 'Перенёс данные со старого аккаунта на новый!') bot.send_message(441399484, 'gotovo') except: bot.send_message(441399484, traceback.format_exc())
def animm(m): config.about(m, bot) if m.from_user.id != 441399484: return if m.chat.id != m.from_user.id: return user = users.find_one({'id':m.from_user.id}) if 'gif' not in user: users.update_one({'id':user['id']},{'$set':{'gif':None}}) user = users.find_one({'id':m.from_user.id}) users.update_one({'id':user['id']},{'$set':{'gif':m.document.file_id}}) bot.send_document(m.chat.id, m.document.file_id)
def globalpeniss(m): config.about(m, bot) if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) penis.update_one({},{'$inc':{'penis':0.1}}) iduser.update_one({'id':m.from_user.id},{'$inc':{'penisincs':0.1}}) p=penis.find_one({}) ps=p['penis'] try: bot.send_message(m.chat.id, 'Вы увеличили мой член на 0.1 см! Текущая длина: '+str(round(ps,2))+' см!') except: pass
def iddd(m): config.about(m, bot) try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) if m.reply_to_message!=None: user=m.reply_to_message.from_user bot.send_message(m.chat.id, 'id выбранного пользователя:\n'+'`'+str(user.id)+'`',reply_to_message_id=m.message_id,parse_mode='markdown') else: bot.send_message(m.chat.id, 'Чтобы узнать id пользователя, введите эту команду, ответив на его сообщение.') except: pass
def imggfdgfg(m): config.about(m, bot) x = iduser.find_one({'id':m.from_user.id}) if x == None: return if m.chat.id == 441399484: try: pic = x['pic'] iduser.update_one({'id':x['id']},{'$set':{'pic':m.photo[0].file_id}}) bot.send_photo(m.chat.id, iduser.find_one({'id':m.from_user.id})['pic']) except: iduser.update_one({'id':x['id']},{'$set':{'pic':m.photo[0].file_id}}) bot.send_photo(m.chat.id, iduser.find_one({'id':m.from_user.id})['pic'])
def feedback(message): try: m=message config.about(m, bot) if message.from_user.id not in ban: incmsg(message.from_user.id, message.chat.id, message.message_id) if message.from_user.username!=None: bot.send_message(314238081, message.text+"\n"+'@'+message.from_user.username) bot.send_message(message.chat.id, 'Сообщение отправлено!') else: bot.send_message(314238081, message.text+"\n"+'@'+'None') bot.send_message(message.chat.id, 'Сообщение отправлено!') except: pass
def sendmesssss(message): m=message config.about(m, bot) if message.from_user.id==441399484: y=iduser.find({}) tex=message.text.split('/sendm') usend=0 for one in y: try: bot.send_message(one['id'], tex[1]) usend+=1 except: pass bot.send_message(441399484, 'Отправлено сообщений юзерам: '+str(usend))
def mme(m): config.about(m, bot) try: if m.text.lower()=='/me' or m.text.lower()=='/me@chlenomerbot': if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) x=iduser.find_one({'id': m.from_user.id}) try: bot.send_message(m.chat.id, m.from_user.first_name+', Ваши членокоины: '+str(x['chlenocoins'])+'. За 5 вы можете купить питомца! (Команда /buypet).') bot.send_message(441399484, m.from_user.first_name+', Ваши членокоины: '+str(x['chlenocoins'])+'. Сейчас они не нужны, но следите за обновлениями - в будущем они понадобятся!') except: bot.send_message(m.chat.id, 'Упс! Какая-то ошибка! Наверное, вы ни разу не измеряли член! (напишите боту "член")') bot.send_message(441399484, 'Упс! Какая-то ошибка! Наверное, вы ни рару не измеряли член!') except: pass
def info(message): m=message config.about(m, bot) if message.from_user.id==441399484: try: group=0 people=0 x=idgroup.find({}) for element in x: group+=1 y=iduser.find({}) for element in y: people+=1 bot.send_message(message.from_user.id, 'Группы: '+str(group)+'\n'+'Люди: '+str(people)) except: bot.send_message(441399484, traceback.format_exc()) bot.send_message(m.chat.id, str(group)+' groups\n'+str(people)+' users')
def addbutt(m): config.about(m, bot) print('1') if m.from_user.id != 441399484: return user = users.find_one({'id':m.from_user.id}) if 'url' not in user: users.update_one({'id':user['id']},{'$set':{'url':None}}) user = users.find_one({'id':m.from_user.id}) try: print('2') url = m.text.split('#^')[1] except: bot.send_message(m.chat.id, 'Error') return users.update_one({'id':user['id']},{'$set':{'url':url}}) print('3') bot.send_message(m.chat.id, '('+url+')')
def size(m): config.about(m, bot) try: if m.from_user.id not in ban: incmsg(m.from_user.id, m.chat.id, m.message_id) x=iduser.find_one({'id':m.from_user.id}) try: sredn=x['summ']/x['kolvo'] sredn=round(sredn, 2) except: sredn=0 try: bot.send_message(m.chat.id, m.from_user.first_name+', средний размер вашего члена: '+str(sredn)+' см.\nВы измеряли член '+str(x['kolvo'])+' раз(а)!') bot.send_message(441399484, m.from_user.first_name+', средний размер вашего члена: '+str(sredn)+' см.\nВы измеряли член '+str(x['kolvo'])+' раз(а)!') except: bot.send_message(m.chat.id, 'Измерьте член хотя бы 1 раз!') except: pass