コード例 #1
0
def command_text_hi(message):
    bot.send_message(message.chat.id,
                     "Hi! What`s problem dude ?\nYou can ask any question.")
    DataBase.db_insert([
        None, message.chat.first_name, message.chat.username, message.chat.id,
        message.from_user.language_code
    ])
コード例 #2
0
def ignore_user_command(message):
    bot.send_message(
        message.chat.id,
        'Do not spam with commands :D\nMy father Cyber Defender!')
    DataBase.db_insert([
        None, message.chat.first_name, message.chat.username, message.chat.id,
        message.from_user.language_code
    ])
コード例 #3
0
def show_faq(message):
    keyboard = telebot.types.InlineKeyboardMarkup()
    url_button = telebot.types.InlineKeyboardButton(
        text="Minerboard FAQ", url="https://minerboard.com/faq.html")
    keyboard.add(url_button)
    bot.send_message(message.chat.id, faq_message, reply_markup=keyboard)
    DataBase.db_insert([
        None, message.chat.first_name, message.chat.username, message.chat.id,
        message.from_user.language_code
    ])
コード例 #4
0
def start_dialogue(message):
    markup = telebot.types.ReplyKeyboardMarkup(one_time_keyboard=False,
                                               resize_keyboard=True)
    list_items = [
        'FAQ',
    ]
    for item in list_items:
        markup.add(item)
    DataBase.db_insert([
        None, message.chat.first_name, message.chat.username, message.chat.id,
        message.from_user.language_code
    ])
    bot.send_message(message.chat.id, reply_markup=markup, text=greeting_info)
コード例 #5
0
def receive_to_user(message):
    bot.send_message(
        admin_chat, '{0}\n{1}\n@{2}\nlang: {4}\n/say{3}'.format(
            message.text, message.chat.first_name, message.chat.username,
            message.chat.id, message.from_user.language_code))
    DataBase.db_insert([
        None, message.chat.first_name, message.chat.username, message.chat.id,
        message.from_user.language_code
    ])
    bot.send_message(
        message.chat.id,
        'Your request is confirmed. Our team will get in touch with you as soon as possible.'
    )
コード例 #6
0
def receive_help_info(message):
    keyboard = telebot.types.InlineKeyboardMarkup()
    mbrd_web_button = telebot.types.InlineKeyboardButton(
        text="Minerboard web-site", url="https://minerboard.com")
    mbrd_bctk_button = telebot.types.InlineKeyboardButton(
        text="Minerboard bitcointalk",
        url=
        "https://bitcointalk.org/index.php?topic=2379339.msg24291948#msg24291948"
    )
    keyboard.add(mbrd_web_button, mbrd_bctk_button)
    bot.send_message(message.chat.id, help_info, reply_markup=keyboard)
    DataBase.db_insert([
        None, message.chat.first_name, message.chat.username, message.chat.id,
        message.from_user.language_code
    ])
コード例 #7
0
def get_user_list(message):
    user_list = DataBase.db_select(full=1).fetchall()
    out_string = ''
    if user_list:
        for i in user_list:
            out_string += 'nick: {0},\nusername: {1},\nid: /say{2},\nlang: {3}.\n'.format(
                i[1], i[2], i[3], i[4])
        bot.send_message(admin_chat, out_string)
    else:
        bot.send_message(admin_chat, 'No users detected or troubles occurred')
コード例 #8
0
def get_user_photo(message):
    cid = message.chat.id
    try:
        fileID = message.photo[-1].file_id
        file_info = bot.get_file(fileID)
        downloaded_file = bot.download_file(file_info.file_path)
        image = config.image_path + str(cid) + '.jpg'
        with open(image, 'wb') as new_file:
            new_file.write(downloaded_file)
        bot.send_message(cid, 'Ok. photo has been grabbed')
        bot.send_photo(
            admin_chat, open(image, 'rb'),
            '{0}\n@{1}\n/say{2}'.format(message.chat.first_name,
                                        message.chat.username,
                                        message.chat.id))
        DataBase.db_insert([
            None, message.chat.first_name, message.chat.username,
            message.chat.id, message.from_user.language_code
        ])

    except Exception:
        bot.send_message(cid, 'Sorry, photo has not grabbed')
コード例 #9
0
def choose_user(message):
    ''' через '/say\d+' выбираем кому пишем '''
    target_id = re.search('(?<=/say)(\d+)', message.text)
    if target_id:
        config.last_id = target_id.group(0)
        user = DataBase.db_select(target_id.group(0)).fetchone()
        bot.send_message(
            admin_chat, 'Напишите сообщение для: ' + target_id.group(0) +
            '\nnickname: ' + user[1] + '\nusername: @' + user[2] +
            '\nДля ответа используйте /a "text".')

    else:
        bot.send_message(admin_chat, 'None')
コード例 #10
0
def get_admin_text(message):
    ''' через '/a ' пишем ответ для определенного пользователя '''
    msg = re.search('(?<=/a )(.*)', message.text)
    if not config.last_id:
        bot.send_message(admin_chat,
                         'Сообщение не отправлено.\nПользователь не найден')
    if config.last_id and msg:
        user = DataBase.db_select(config.last_id).fetchone()
        bot.send_message(
            admin_chat, 'Сообщение для пользователя: ' + str(config.last_id) +
            '\nnickname: ' + user[1] + '\nusername: @' + user[2] +
            ' отправлено:\n' + msg.group(0))
        bot.send_chat_action(config.last_id,
                             'typing')  # show the bot "typing" (max. 5 secs)
        time.sleep(3)
        bot.send_message(config.last_id, msg.group(0))
        config.last_id = None
コード例 #11
0
ファイル: start.py プロジェクト: Stevie-Bs/ru
import xbmc, xbmcaddon, xbmcgui, xbmcplugin
import os, sys, urllib2, re, time

__addon__ = xbmcaddon.Addon(id="plugin.video.megogo")
addon_name = __addon__.getAddonInfo("name")
addon_version = __addon__.getAddonInfo("version")
addon_path = xbmc.translatePath(__addon__.getAddonInfo("path")).decode("utf-8")
language = __addon__.getLocalizedString
source = "http://raw.github.com/GeekEdem/zip/master/plugin.video.megogo/addon.xml"

sys.path.append(os.path.join(addon_path, "resources", "lib"))
from megogo2xbmc import getconfiguration
from sqlite import DataBase

db = DataBase()

xbmc.log("[%s]: Start plugin! Version: %s" % (addon_name, addon_version))

# ##################################	  Start Splash	    ####################################### #
splash = xbmcgui.WindowXML("splash.xml", addon_path)
splash.show()
xbmc.executebuiltin("ActivateWindow(busydialog)")

# ##################################		First run		####################################### #
if __addon__.getSetting("firstrun") == "0" or __addon__.getSetting("firstrun") == "":
    __addon__.openSettings()
    __addon__.setSetting(id="firstrun", value="1")

# ##################################  SET UI LANGUAGE 'RU'	####################################### #
if __addon__.getSetting("language") == "0" or __addon__.getSetting("language") == "":
コード例 #12
0
from time import sleep
from sqlite import DataBase
from random import choice
from moviepy.editor import VideoFileClip

from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtCore import QDir, Qt, QUrl, QSize, QTimer
from PyQt5.QtMultimedia import QMediaContent, QMediaPlayer
from PyQt5.QtMultimediaWidgets import QVideoWidget
from PyQt5.QtWidgets import (QApplication, QFileDialog, QHBoxLayout, QLabel,
                             QPushButton, QSizePolicy, QSlider, QStyle,
                             QVBoxLayout, QWidget, QStatusBar)
import os

bd = DataBase('data/user.db')


class VideoPlayer(QWidget):
    def __init__(self, parent=None):
        super(VideoPlayer, self).__init__(parent)

        self.mediaPlayer = QMediaPlayer(None, QMediaPlayer.VideoSurface)
        self.videoWidget = QVideoWidget()

        controlLayout = QHBoxLayout()
        controlLayout.setContentsMargins(0, 0, 0, 0)
        layout = QVBoxLayout()
        layout.addWidget(self.videoWidget)
        layout.addLayout(controlLayout)
        self.setLayout(layout)
        # ПЛЕЕР
コード例 #13
0
ファイル: bot.py プロジェクト: chibiherbie/film
import logging
import config
from aiogram import Bot, Dispatcher, executor, types
from sqlite import DataBase
import asyncio

bot = Bot(token=config.TOKEN)
dp = Dispatcher(bot)

logging.basicConfig(level=logging.INFO)

bd = DataBase('data/user.db')
bd.clear()  # очищаем бд


# приветственное слово
@dp.message_handler(commands=['start'])
async def hi(message: types.Message):
    await message.answer(
        'Привет! Добро пожаловать. Следи за игрой и успевай отправлять ответы')


# обработка сообщений
@dp.message_handler(content_types=['text'])
async def said(message: types.Message):
    if '1' != message.text and '2' != message.text and '3' != message.text:
        await message.answer('Такого варианта ответа нет')
    elif not bd.check_id(message.from_user.id):
        bd.new_user(
            message.from_user.id,
            message.text)  # заносим id в бд для защиты от спама ответов
コード例 #14
0
ファイル: start.py プロジェクト: videoprsnsa/ru
# -*- coding: utf-8 -*-

import xbmc, xbmcaddon, xbmcgui, xbmcplugin
import os, sys, urllib2, re, time

__addon__ = xbmcaddon.Addon(id='plugin.video.megogo')
addon_name = __addon__.getAddonInfo('name')
addon_version = __addon__.getAddonInfo('version')
addon_path = xbmc.translatePath(__addon__.getAddonInfo('path')).decode('utf-8')
language = __addon__.getLocalizedString
source = 'http://raw.github.com/GeekEdem/zip/master/plugin.video.megogo/addon.xml'

sys.path.append(os.path.join(addon_path, 'resources', 'lib'))
from megogo2xbmc import getconfiguration
from sqlite import DataBase
db = DataBase()

xbmc.log('[%s]: Start plugin! Version: %s' % (addon_name, addon_version))

# ##################################	  Start Splash	    ####################################### #
splash = xbmcgui.WindowXML('splash.xml', addon_path)
splash.show()
xbmc.executebuiltin("ActivateWindow(busydialog)")

# ##################################		First run		####################################### #
if __addon__.getSetting('firstrun') == '0' or __addon__.getSetting(
        'firstrun') == '':
    __addon__.openSettings()
    __addon__.setSetting(id='firstrun', value='1')

# ##################################  SET UI LANGUAGE 'RU'	####################################### #