mirror of
https://github.com/house-of-vanity/conf_bot.git
synced 2025-07-06 14:24:08 +00:00
It works again.
This commit is contained in:
@ -1 +1,2 @@
|
|||||||
openssl req -newkey rsa:2048 -sha256 -nodes -keyout cert.key -x509 -days 3650 -out cert.pem -subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=hexor.ru"
|
openssl req -newkey rsa:2048 -sha256 -nodes -keyout cert.key -x509 -days 3650 -out cert.pem -subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=des.hexor.ru"
|
||||||
|
|
||||||
|
@ -1,51 +1,3 @@
|
|||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
--- CREATE TABLE `word` (
|
|
||||||
--- `id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
--- `word` TEXT UNIQUE
|
|
||||||
--- );
|
|
||||||
--- CREATE TABLE sqlite_sequence(name,seq);
|
|
||||||
--- CREATE TABLE `user` (
|
|
||||||
--- `id` INTEGER NOT NULL UNIQUE,
|
|
||||||
--- `username` TEXT NOT NULL,
|
|
||||||
--- `first_name` TEXT NOT NULL,
|
|
||||||
--- `last_name` TEXT NOT NULL,
|
|
||||||
--- `date` INTEGER NOT NULL,
|
|
||||||
--- PRIMARY KEY(`id`)
|
|
||||||
--- );
|
|
||||||
--- CREATE TABLE `conf` (
|
|
||||||
--- `id` NUMERIC NOT NULL UNIQUE,
|
|
||||||
--- `title` TEXT,
|
|
||||||
--- `date` INTEGER NOT NULL,
|
|
||||||
--- PRIMARY KEY(`id`)
|
|
||||||
--- );
|
|
||||||
--- CREATE TABLE `xxx_message` (`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `text` TEXT UNIQUE NULL);
|
|
||||||
--- CREATE TABLE IF NOT EXISTS "relations" (
|
|
||||||
--- `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
||||||
--- `word_id` INTEGER NOT NULL,
|
|
||||||
--- `user_id` INTEGER NOT NULL,
|
|
||||||
--- `conf_id` INTEGER NOT NULL,
|
|
||||||
--- `msg_id` INTEGER NOT NULL,
|
|
||||||
--- `date` INTEGER NOT NULL,
|
|
||||||
--- FOREIGN KEY(`word_id`) REFERENCES `word`(`id`) ON DELETE CASCADE,
|
|
||||||
--- FOREIGN KEY(`user_id`) REFERENCES `user`(`id`),
|
|
||||||
--- FOREIGN KEY(`conf_id`) REFERENCES `conf`(`id`)
|
|
||||||
--- );
|
|
||||||
--- CREATE TABLE `reset` (
|
|
||||||
--- `id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
--- `user_id` INTEGER,
|
|
||||||
--- `conf_id` INTEGER,
|
|
||||||
--- `date` INTEGER,
|
|
||||||
--- `relation_id` INTEGER,
|
|
||||||
--- FOREIGN KEY(`user_id`) REFERENCES `user`(`id`)
|
|
||||||
--- );
|
|
||||||
--- CREATE TABLE `alert` (
|
|
||||||
--- `conf_id`TEXT NOT NULL,
|
|
||||||
--- `user_id`TEXT NOT NULL,
|
|
||||||
--- `created`TEXT NOT NULL,
|
|
||||||
--- `time`TEXT NOT NULL,
|
|
||||||
--- `message`TEXT
|
|
||||||
--- );
|
|
||||||
CREATE TABLE `word` (
|
CREATE TABLE `word` (
|
||||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
`word` TEXT UNIQUE
|
`word` TEXT UNIQUE
|
||||||
@ -91,4 +43,3 @@ CREATE TABLE `alert` (
|
|||||||
`message`TEXT
|
`message`TEXT
|
||||||
);
|
);
|
||||||
CREATE TABLE `xxx_message` (`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `text`TEXT UNIQUE NULL);
|
CREATE TABLE `xxx_message` (`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `text`TEXT UNIQUE NULL);
|
||||||
COMMIT;
|
|
||||||
|
76
puller.py
Normal file
76
puller.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
import settings
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
#from webhook import WebHook
|
||||||
|
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.DEBUG,
|
||||||
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# catch ctrl+c
|
||||||
|
def signal_handler(signal, frame):
|
||||||
|
print('Exiting...')
|
||||||
|
settings.db.close()
|
||||||
|
sys.exit(0)
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
|
|
||||||
|
# Define a few command handlers. These usually take the two arguments bot and
|
||||||
|
# update. Error handlers also receive the raised TelegramError object in error.
|
||||||
|
def start(update, context):
|
||||||
|
"""Send a message when the command /start is issued."""
|
||||||
|
update.message.reply_text('Hi!')
|
||||||
|
|
||||||
|
|
||||||
|
def help(update, context):
|
||||||
|
"""Send a message when the command /help is issued."""
|
||||||
|
update.message.reply_text('Help!')
|
||||||
|
|
||||||
|
|
||||||
|
def echo(update, context):
|
||||||
|
"""Echo the user message."""
|
||||||
|
update.message.reply_text(update.message.text)
|
||||||
|
|
||||||
|
|
||||||
|
def error(update, context):
|
||||||
|
"""Log Errors caused by Updates."""
|
||||||
|
logger.warning('Update "%s" caused error "%s"', update, context.error)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Start the bot."""
|
||||||
|
# Create the Updater and pass it your bot's token.
|
||||||
|
# Make sure to set use_context=True to use the new context based callbacks
|
||||||
|
# Post version 12 this will no longer be necessary
|
||||||
|
token = settings.parser.get('bot', 'telegram_key')
|
||||||
|
updater = Updater(token, use_context=True)
|
||||||
|
|
||||||
|
# Get the dispatcher to register handlers
|
||||||
|
dp = updater.dispatcher
|
||||||
|
|
||||||
|
# on different commands - answer in Telegram
|
||||||
|
dp.add_handler(CommandHandler("start", start))
|
||||||
|
dp.add_handler(CommandHandler("help", help))
|
||||||
|
|
||||||
|
# on noncommand i.e message - echo the message on Telegram
|
||||||
|
dp.add_handler(MessageHandler(Filters.text, echo))
|
||||||
|
|
||||||
|
# log all errors
|
||||||
|
dp.add_error_handler(error)
|
||||||
|
|
||||||
|
# Start the Bot
|
||||||
|
updater.start_polling()
|
||||||
|
|
||||||
|
# Run the bot until you press Ctrl-C or the process receives SIGINT,
|
||||||
|
# SIGTERM or SIGABRT. This should be used most of the time, since
|
||||||
|
# start_polling() is non-blocking and will stop the bot gracefully.
|
||||||
|
updater.idle()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
822
vim-session
Normal file
822
vim-session
Normal file
@ -0,0 +1,822 @@
|
|||||||
|
let SessionLoad = 1
|
||||||
|
if &cp | set nocp | endif
|
||||||
|
map Q gq
|
||||||
|
let s:cpo_save=&cpo
|
||||||
|
set cpo&vim
|
||||||
|
vmap gx <Plug>NetrwBrowseXVis
|
||||||
|
nmap gx <Plug>NetrwBrowseX
|
||||||
|
vnoremap <silent> <Plug>NetrwBrowseXVis :call netrw#BrowseXVis()
|
||||||
|
nnoremap <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())
|
||||||
|
inoremap u
|
||||||
|
let &cpo=s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
set background=dark
|
||||||
|
set backspace=indent,eol,start
|
||||||
|
set display=truncate
|
||||||
|
set fileencodings=ucs-bom,utf-8,default,latin1
|
||||||
|
set helplang=en
|
||||||
|
set history=200
|
||||||
|
set incsearch
|
||||||
|
set langnoremap
|
||||||
|
set nolangremap
|
||||||
|
set nomodeline
|
||||||
|
set nrformats=bin,hex
|
||||||
|
set ruler
|
||||||
|
set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim80,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
|
||||||
|
set scrolloff=5
|
||||||
|
set showcmd
|
||||||
|
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
|
||||||
|
set ttimeout
|
||||||
|
set ttimeoutlen=100
|
||||||
|
set wildignore=*.pyc
|
||||||
|
set wildmenu
|
||||||
|
let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
|
||||||
|
let v:this_session=expand("<sfile>:p")
|
||||||
|
silent only
|
||||||
|
cd ~/repos/conf_bot
|
||||||
|
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
||||||
|
let s:wipebuf = bufnr('%')
|
||||||
|
endif
|
||||||
|
set shortmess=aoO
|
||||||
|
badd +0 puller.py
|
||||||
|
badd +0 main.py
|
||||||
|
badd +0 settings.py
|
||||||
|
badd +0 webhook.py
|
||||||
|
badd +0 assets/settings.ini
|
||||||
|
badd +0 worker.py
|
||||||
|
argglobal
|
||||||
|
silent! argdel *
|
||||||
|
$argadd puller.py
|
||||||
|
set stal=2
|
||||||
|
edit puller.py
|
||||||
|
set splitbelow splitright
|
||||||
|
set nosplitbelow
|
||||||
|
set nosplitright
|
||||||
|
wincmd t
|
||||||
|
set winminheight=1 winheight=1 winminwidth=1 winwidth=1
|
||||||
|
argglobal
|
||||||
|
setlocal keymap=
|
||||||
|
setlocal noarabic
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal backupcopy=
|
||||||
|
setlocal balloonexpr=
|
||||||
|
setlocal nobinary
|
||||||
|
setlocal nobreakindent
|
||||||
|
setlocal breakindentopt=
|
||||||
|
setlocal bufhidden=
|
||||||
|
setlocal buflisted
|
||||||
|
setlocal buftype=
|
||||||
|
setlocal nocindent
|
||||||
|
setlocal cinkeys=0{,0},0),:,!^F,o,O,e
|
||||||
|
setlocal cinoptions=
|
||||||
|
setlocal cinwords=if,else,while,do,for,switch
|
||||||
|
setlocal colorcolumn=
|
||||||
|
setlocal comments=b:#,fb:-
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
setlocal complete=.,w,b,u,t,i
|
||||||
|
setlocal concealcursor=
|
||||||
|
setlocal conceallevel=0
|
||||||
|
setlocal completefunc=
|
||||||
|
setlocal nocopyindent
|
||||||
|
setlocal cryptmethod=
|
||||||
|
setlocal nocursorbind
|
||||||
|
setlocal nocursorcolumn
|
||||||
|
setlocal nocursorline
|
||||||
|
setlocal define=
|
||||||
|
setlocal dictionary=
|
||||||
|
setlocal nodiff
|
||||||
|
setlocal equalprg=
|
||||||
|
setlocal errorformat=
|
||||||
|
setlocal expandtab
|
||||||
|
if &filetype != 'python'
|
||||||
|
setlocal filetype=python
|
||||||
|
endif
|
||||||
|
setlocal fixendofline
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
setlocal foldenable
|
||||||
|
setlocal foldexpr=0
|
||||||
|
setlocal foldignore=#
|
||||||
|
setlocal foldlevel=0
|
||||||
|
setlocal foldmarker={{{,}}}
|
||||||
|
setlocal foldmethod=manual
|
||||||
|
setlocal foldminlines=1
|
||||||
|
setlocal foldnestmax=20
|
||||||
|
setlocal foldtext=foldtext()
|
||||||
|
setlocal formatexpr=
|
||||||
|
setlocal formatoptions=tcq
|
||||||
|
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
||||||
|
setlocal formatprg=
|
||||||
|
setlocal grepprg=
|
||||||
|
setlocal iminsert=0
|
||||||
|
setlocal imsearch=-1
|
||||||
|
setlocal include=^\\s*\\(from\\|import\\)
|
||||||
|
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
|
||||||
|
setlocal indentexpr=GetPythonIndent(v:lnum)
|
||||||
|
setlocal indentkeys=0{,0},:,!^F,o,O,e,<:>,=elif,=except
|
||||||
|
setlocal noinfercase
|
||||||
|
setlocal iskeyword=@,48-57,_,192-255
|
||||||
|
setlocal keywordprg=
|
||||||
|
setlocal nolinebreak
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal lispwords=
|
||||||
|
setlocal nolist
|
||||||
|
setlocal makeencoding=
|
||||||
|
setlocal makeprg=
|
||||||
|
setlocal matchpairs=(:),{:},[:]
|
||||||
|
setlocal nomodeline
|
||||||
|
setlocal modifiable
|
||||||
|
setlocal nrformats=bin,hex
|
||||||
|
setlocal nonumber
|
||||||
|
setlocal numberwidth=4
|
||||||
|
setlocal omnifunc=python3complete#Complete
|
||||||
|
setlocal path=
|
||||||
|
setlocal nopreserveindent
|
||||||
|
setlocal nopreviewwindow
|
||||||
|
setlocal quoteescape=\\
|
||||||
|
setlocal noreadonly
|
||||||
|
setlocal norelativenumber
|
||||||
|
setlocal norightleft
|
||||||
|
setlocal rightleftcmd=search
|
||||||
|
setlocal noscrollbind
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
setlocal noshortname
|
||||||
|
setlocal signcolumn=auto
|
||||||
|
setlocal nosmartindent
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal nospell
|
||||||
|
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
||||||
|
setlocal spellfile=
|
||||||
|
setlocal spelllang=en
|
||||||
|
setlocal statusline=
|
||||||
|
setlocal suffixesadd=.py
|
||||||
|
setlocal swapfile
|
||||||
|
setlocal synmaxcol=3000
|
||||||
|
if &syntax != 'python'
|
||||||
|
setlocal syntax=python
|
||||||
|
endif
|
||||||
|
setlocal tabstop=8
|
||||||
|
setlocal tagcase=
|
||||||
|
setlocal tags=
|
||||||
|
setlocal termkey=
|
||||||
|
setlocal termsize=
|
||||||
|
setlocal textwidth=0
|
||||||
|
setlocal thesaurus=
|
||||||
|
setlocal noundofile
|
||||||
|
setlocal undolevels=-123456
|
||||||
|
setlocal nowinfixheight
|
||||||
|
setlocal nowinfixwidth
|
||||||
|
setlocal wrap
|
||||||
|
setlocal wrapmargin=0
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 51 - ((50 * winheight(0) + 51) / 102)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
51
|
||||||
|
normal! 027|
|
||||||
|
tabedit settings.py
|
||||||
|
set splitbelow splitright
|
||||||
|
set nosplitbelow
|
||||||
|
set nosplitright
|
||||||
|
wincmd t
|
||||||
|
set winminheight=1 winheight=1 winminwidth=1 winwidth=1
|
||||||
|
argglobal
|
||||||
|
setlocal keymap=
|
||||||
|
setlocal noarabic
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal backupcopy=
|
||||||
|
setlocal balloonexpr=
|
||||||
|
setlocal nobinary
|
||||||
|
setlocal nobreakindent
|
||||||
|
setlocal breakindentopt=
|
||||||
|
setlocal bufhidden=
|
||||||
|
setlocal buflisted
|
||||||
|
setlocal buftype=
|
||||||
|
setlocal nocindent
|
||||||
|
setlocal cinkeys=0{,0},0),:,!^F,o,O,e
|
||||||
|
setlocal cinoptions=
|
||||||
|
setlocal cinwords=if,else,while,do,for,switch
|
||||||
|
setlocal colorcolumn=
|
||||||
|
setlocal comments=b:#,fb:-
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
setlocal complete=.,w,b,u,t,i
|
||||||
|
setlocal concealcursor=
|
||||||
|
setlocal conceallevel=0
|
||||||
|
setlocal completefunc=
|
||||||
|
setlocal nocopyindent
|
||||||
|
setlocal cryptmethod=
|
||||||
|
setlocal nocursorbind
|
||||||
|
setlocal nocursorcolumn
|
||||||
|
setlocal nocursorline
|
||||||
|
setlocal define=
|
||||||
|
setlocal dictionary=
|
||||||
|
setlocal nodiff
|
||||||
|
setlocal equalprg=
|
||||||
|
setlocal errorformat=
|
||||||
|
setlocal expandtab
|
||||||
|
if &filetype != 'python'
|
||||||
|
setlocal filetype=python
|
||||||
|
endif
|
||||||
|
setlocal fixendofline
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
setlocal foldenable
|
||||||
|
setlocal foldexpr=0
|
||||||
|
setlocal foldignore=#
|
||||||
|
setlocal foldlevel=0
|
||||||
|
setlocal foldmarker={{{,}}}
|
||||||
|
setlocal foldmethod=manual
|
||||||
|
setlocal foldminlines=1
|
||||||
|
setlocal foldnestmax=20
|
||||||
|
setlocal foldtext=foldtext()
|
||||||
|
setlocal formatexpr=
|
||||||
|
setlocal formatoptions=tcq
|
||||||
|
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
||||||
|
setlocal formatprg=
|
||||||
|
setlocal grepprg=
|
||||||
|
setlocal iminsert=0
|
||||||
|
setlocal imsearch=-1
|
||||||
|
setlocal include=^\\s*\\(from\\|import\\)
|
||||||
|
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
|
||||||
|
setlocal indentexpr=GetPythonIndent(v:lnum)
|
||||||
|
setlocal indentkeys=0{,0},:,!^F,o,O,e,<:>,=elif,=except
|
||||||
|
setlocal noinfercase
|
||||||
|
setlocal iskeyword=@,48-57,_,192-255
|
||||||
|
setlocal keywordprg=
|
||||||
|
setlocal nolinebreak
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal lispwords=
|
||||||
|
setlocal nolist
|
||||||
|
setlocal makeencoding=
|
||||||
|
setlocal makeprg=
|
||||||
|
setlocal matchpairs=(:),{:},[:]
|
||||||
|
setlocal nomodeline
|
||||||
|
setlocal modifiable
|
||||||
|
setlocal nrformats=bin,hex
|
||||||
|
setlocal nonumber
|
||||||
|
setlocal numberwidth=4
|
||||||
|
setlocal omnifunc=python3complete#Complete
|
||||||
|
setlocal path=
|
||||||
|
setlocal nopreserveindent
|
||||||
|
setlocal nopreviewwindow
|
||||||
|
setlocal quoteescape=\\
|
||||||
|
setlocal noreadonly
|
||||||
|
setlocal norelativenumber
|
||||||
|
setlocal norightleft
|
||||||
|
setlocal rightleftcmd=search
|
||||||
|
setlocal noscrollbind
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
setlocal noshortname
|
||||||
|
setlocal signcolumn=auto
|
||||||
|
setlocal nosmartindent
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal nospell
|
||||||
|
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
||||||
|
setlocal spellfile=
|
||||||
|
setlocal spelllang=en
|
||||||
|
setlocal statusline=
|
||||||
|
setlocal suffixesadd=.py
|
||||||
|
setlocal swapfile
|
||||||
|
setlocal synmaxcol=3000
|
||||||
|
if &syntax != 'python'
|
||||||
|
setlocal syntax=python
|
||||||
|
endif
|
||||||
|
setlocal tabstop=8
|
||||||
|
setlocal tagcase=
|
||||||
|
setlocal tags=
|
||||||
|
setlocal termkey=
|
||||||
|
setlocal termsize=
|
||||||
|
setlocal textwidth=0
|
||||||
|
setlocal thesaurus=
|
||||||
|
setlocal noundofile
|
||||||
|
setlocal undolevels=-123456
|
||||||
|
setlocal nowinfixheight
|
||||||
|
setlocal nowinfixwidth
|
||||||
|
setlocal wrap
|
||||||
|
setlocal wrapmargin=0
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 5 - ((4 * winheight(0) + 51) / 102)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
5
|
||||||
|
normal! 0
|
||||||
|
tabedit webhook.py
|
||||||
|
set splitbelow splitright
|
||||||
|
set nosplitbelow
|
||||||
|
set nosplitright
|
||||||
|
wincmd t
|
||||||
|
set winminheight=1 winheight=1 winminwidth=1 winwidth=1
|
||||||
|
argglobal
|
||||||
|
setlocal keymap=
|
||||||
|
setlocal noarabic
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal backupcopy=
|
||||||
|
setlocal balloonexpr=
|
||||||
|
setlocal nobinary
|
||||||
|
setlocal nobreakindent
|
||||||
|
setlocal breakindentopt=
|
||||||
|
setlocal bufhidden=
|
||||||
|
setlocal buflisted
|
||||||
|
setlocal buftype=
|
||||||
|
setlocal nocindent
|
||||||
|
setlocal cinkeys=0{,0},0),:,!^F,o,O,e
|
||||||
|
setlocal cinoptions=
|
||||||
|
setlocal cinwords=if,else,while,do,for,switch
|
||||||
|
setlocal colorcolumn=
|
||||||
|
setlocal comments=b:#,fb:-
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
setlocal complete=.,w,b,u,t,i
|
||||||
|
setlocal concealcursor=
|
||||||
|
setlocal conceallevel=0
|
||||||
|
setlocal completefunc=
|
||||||
|
setlocal nocopyindent
|
||||||
|
setlocal cryptmethod=
|
||||||
|
setlocal nocursorbind
|
||||||
|
setlocal nocursorcolumn
|
||||||
|
setlocal nocursorline
|
||||||
|
setlocal define=
|
||||||
|
setlocal dictionary=
|
||||||
|
setlocal nodiff
|
||||||
|
setlocal equalprg=
|
||||||
|
setlocal errorformat=
|
||||||
|
setlocal expandtab
|
||||||
|
if &filetype != 'python'
|
||||||
|
setlocal filetype=python
|
||||||
|
endif
|
||||||
|
setlocal fixendofline
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
setlocal foldenable
|
||||||
|
setlocal foldexpr=0
|
||||||
|
setlocal foldignore=#
|
||||||
|
setlocal foldlevel=0
|
||||||
|
setlocal foldmarker={{{,}}}
|
||||||
|
setlocal foldmethod=manual
|
||||||
|
setlocal foldminlines=1
|
||||||
|
setlocal foldnestmax=20
|
||||||
|
setlocal foldtext=foldtext()
|
||||||
|
setlocal formatexpr=
|
||||||
|
setlocal formatoptions=tcq
|
||||||
|
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
||||||
|
setlocal formatprg=
|
||||||
|
setlocal grepprg=
|
||||||
|
setlocal iminsert=0
|
||||||
|
setlocal imsearch=-1
|
||||||
|
setlocal include=^\\s*\\(from\\|import\\)
|
||||||
|
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
|
||||||
|
setlocal indentexpr=GetPythonIndent(v:lnum)
|
||||||
|
setlocal indentkeys=0{,0},:,!^F,o,O,e,<:>,=elif,=except
|
||||||
|
setlocal noinfercase
|
||||||
|
setlocal iskeyword=@,48-57,_,192-255
|
||||||
|
setlocal keywordprg=
|
||||||
|
setlocal nolinebreak
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal lispwords=
|
||||||
|
setlocal nolist
|
||||||
|
setlocal makeencoding=
|
||||||
|
setlocal makeprg=
|
||||||
|
setlocal matchpairs=(:),{:},[:]
|
||||||
|
setlocal nomodeline
|
||||||
|
setlocal modifiable
|
||||||
|
setlocal nrformats=bin,hex
|
||||||
|
setlocal nonumber
|
||||||
|
setlocal numberwidth=4
|
||||||
|
setlocal omnifunc=python3complete#Complete
|
||||||
|
setlocal path=
|
||||||
|
setlocal nopreserveindent
|
||||||
|
setlocal nopreviewwindow
|
||||||
|
setlocal quoteescape=\\
|
||||||
|
setlocal noreadonly
|
||||||
|
setlocal norelativenumber
|
||||||
|
setlocal norightleft
|
||||||
|
setlocal rightleftcmd=search
|
||||||
|
setlocal noscrollbind
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
setlocal noshortname
|
||||||
|
setlocal signcolumn=auto
|
||||||
|
setlocal nosmartindent
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal nospell
|
||||||
|
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
||||||
|
setlocal spellfile=
|
||||||
|
setlocal spelllang=en
|
||||||
|
setlocal statusline=
|
||||||
|
setlocal suffixesadd=.py
|
||||||
|
setlocal swapfile
|
||||||
|
setlocal synmaxcol=3000
|
||||||
|
if &syntax != 'python'
|
||||||
|
setlocal syntax=python
|
||||||
|
endif
|
||||||
|
setlocal tabstop=8
|
||||||
|
setlocal tagcase=
|
||||||
|
setlocal tags=
|
||||||
|
setlocal termkey=
|
||||||
|
setlocal termsize=
|
||||||
|
setlocal textwidth=0
|
||||||
|
setlocal thesaurus=
|
||||||
|
setlocal noundofile
|
||||||
|
setlocal undolevels=-123456
|
||||||
|
setlocal nowinfixheight
|
||||||
|
setlocal nowinfixwidth
|
||||||
|
setlocal wrap
|
||||||
|
setlocal wrapmargin=0
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 1 - ((0 * winheight(0) + 51) / 102)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
1
|
||||||
|
normal! 0
|
||||||
|
tabedit worker.py
|
||||||
|
set splitbelow splitright
|
||||||
|
set nosplitbelow
|
||||||
|
set nosplitright
|
||||||
|
wincmd t
|
||||||
|
set winminheight=1 winheight=1 winminwidth=1 winwidth=1
|
||||||
|
argglobal
|
||||||
|
setlocal keymap=
|
||||||
|
setlocal noarabic
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal backupcopy=
|
||||||
|
setlocal balloonexpr=
|
||||||
|
setlocal nobinary
|
||||||
|
setlocal nobreakindent
|
||||||
|
setlocal breakindentopt=
|
||||||
|
setlocal bufhidden=
|
||||||
|
setlocal buflisted
|
||||||
|
setlocal buftype=
|
||||||
|
setlocal nocindent
|
||||||
|
setlocal cinkeys=0{,0},0),:,!^F,o,O,e
|
||||||
|
setlocal cinoptions=
|
||||||
|
setlocal cinwords=if,else,while,do,for,switch
|
||||||
|
setlocal colorcolumn=
|
||||||
|
setlocal comments=b:#,fb:-
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
setlocal complete=.,w,b,u,t,i
|
||||||
|
setlocal concealcursor=
|
||||||
|
setlocal conceallevel=0
|
||||||
|
setlocal completefunc=
|
||||||
|
setlocal nocopyindent
|
||||||
|
setlocal cryptmethod=
|
||||||
|
setlocal nocursorbind
|
||||||
|
setlocal nocursorcolumn
|
||||||
|
setlocal nocursorline
|
||||||
|
setlocal define=
|
||||||
|
setlocal dictionary=
|
||||||
|
setlocal nodiff
|
||||||
|
setlocal equalprg=
|
||||||
|
setlocal errorformat=
|
||||||
|
setlocal expandtab
|
||||||
|
if &filetype != 'python'
|
||||||
|
setlocal filetype=python
|
||||||
|
endif
|
||||||
|
setlocal fixendofline
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
setlocal foldenable
|
||||||
|
setlocal foldexpr=0
|
||||||
|
setlocal foldignore=#
|
||||||
|
setlocal foldlevel=0
|
||||||
|
setlocal foldmarker={{{,}}}
|
||||||
|
setlocal foldmethod=manual
|
||||||
|
setlocal foldminlines=1
|
||||||
|
setlocal foldnestmax=20
|
||||||
|
setlocal foldtext=foldtext()
|
||||||
|
setlocal formatexpr=
|
||||||
|
setlocal formatoptions=tcq
|
||||||
|
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
||||||
|
setlocal formatprg=
|
||||||
|
setlocal grepprg=
|
||||||
|
setlocal iminsert=0
|
||||||
|
setlocal imsearch=-1
|
||||||
|
setlocal include=^\\s*\\(from\\|import\\)
|
||||||
|
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
|
||||||
|
setlocal indentexpr=GetPythonIndent(v:lnum)
|
||||||
|
setlocal indentkeys=0{,0},:,!^F,o,O,e,<:>,=elif,=except
|
||||||
|
setlocal noinfercase
|
||||||
|
setlocal iskeyword=@,48-57,_,192-255
|
||||||
|
setlocal keywordprg=
|
||||||
|
setlocal nolinebreak
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal lispwords=
|
||||||
|
setlocal nolist
|
||||||
|
setlocal makeencoding=
|
||||||
|
setlocal makeprg=
|
||||||
|
setlocal matchpairs=(:),{:},[:]
|
||||||
|
setlocal nomodeline
|
||||||
|
setlocal modifiable
|
||||||
|
setlocal nrformats=bin,hex
|
||||||
|
setlocal nonumber
|
||||||
|
setlocal numberwidth=4
|
||||||
|
setlocal omnifunc=python3complete#Complete
|
||||||
|
setlocal path=
|
||||||
|
setlocal nopreserveindent
|
||||||
|
setlocal nopreviewwindow
|
||||||
|
setlocal quoteescape=\\
|
||||||
|
setlocal noreadonly
|
||||||
|
setlocal norelativenumber
|
||||||
|
setlocal norightleft
|
||||||
|
setlocal rightleftcmd=search
|
||||||
|
setlocal noscrollbind
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
setlocal noshortname
|
||||||
|
setlocal signcolumn=auto
|
||||||
|
setlocal nosmartindent
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal nospell
|
||||||
|
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
||||||
|
setlocal spellfile=
|
||||||
|
setlocal spelllang=en
|
||||||
|
setlocal statusline=
|
||||||
|
setlocal suffixesadd=.py
|
||||||
|
setlocal swapfile
|
||||||
|
setlocal synmaxcol=3000
|
||||||
|
if &syntax != 'python'
|
||||||
|
setlocal syntax=python
|
||||||
|
endif
|
||||||
|
setlocal tabstop=8
|
||||||
|
setlocal tagcase=
|
||||||
|
setlocal tags=
|
||||||
|
setlocal termkey=
|
||||||
|
setlocal termsize=
|
||||||
|
setlocal textwidth=0
|
||||||
|
setlocal thesaurus=
|
||||||
|
setlocal noundofile
|
||||||
|
setlocal undolevels=-123456
|
||||||
|
setlocal nowinfixheight
|
||||||
|
setlocal nowinfixwidth
|
||||||
|
setlocal wrap
|
||||||
|
setlocal wrapmargin=0
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 31 - ((30 * winheight(0) + 51) / 102)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
31
|
||||||
|
normal! 09|
|
||||||
|
tabedit assets/settings.ini
|
||||||
|
set splitbelow splitright
|
||||||
|
set nosplitbelow
|
||||||
|
set nosplitright
|
||||||
|
wincmd t
|
||||||
|
set winminheight=1 winheight=1 winminwidth=1 winwidth=1
|
||||||
|
argglobal
|
||||||
|
setlocal keymap=
|
||||||
|
setlocal noarabic
|
||||||
|
setlocal noautoindent
|
||||||
|
setlocal backupcopy=
|
||||||
|
setlocal balloonexpr=
|
||||||
|
setlocal nobinary
|
||||||
|
setlocal nobreakindent
|
||||||
|
setlocal breakindentopt=
|
||||||
|
setlocal bufhidden=
|
||||||
|
setlocal buflisted
|
||||||
|
setlocal buftype=
|
||||||
|
setlocal nocindent
|
||||||
|
setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e
|
||||||
|
setlocal cinoptions=
|
||||||
|
setlocal cinwords=if,else,while,do,for,switch
|
||||||
|
setlocal colorcolumn=
|
||||||
|
setlocal comments=:;
|
||||||
|
setlocal commentstring=;\ %s
|
||||||
|
setlocal complete=.,w,b,u,t,i
|
||||||
|
setlocal concealcursor=
|
||||||
|
setlocal conceallevel=0
|
||||||
|
setlocal completefunc=
|
||||||
|
setlocal nocopyindent
|
||||||
|
setlocal cryptmethod=
|
||||||
|
setlocal nocursorbind
|
||||||
|
setlocal nocursorcolumn
|
||||||
|
setlocal nocursorline
|
||||||
|
setlocal define=
|
||||||
|
setlocal dictionary=
|
||||||
|
setlocal nodiff
|
||||||
|
setlocal equalprg=
|
||||||
|
setlocal errorformat=
|
||||||
|
setlocal noexpandtab
|
||||||
|
if &filetype != 'dosini'
|
||||||
|
setlocal filetype=dosini
|
||||||
|
endif
|
||||||
|
setlocal fixendofline
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
setlocal foldenable
|
||||||
|
setlocal foldexpr=0
|
||||||
|
setlocal foldignore=#
|
||||||
|
setlocal foldlevel=0
|
||||||
|
setlocal foldmarker={{{,}}}
|
||||||
|
setlocal foldmethod=manual
|
||||||
|
setlocal foldminlines=1
|
||||||
|
setlocal foldnestmax=20
|
||||||
|
setlocal foldtext=foldtext()
|
||||||
|
setlocal formatexpr=
|
||||||
|
setlocal formatoptions=croql
|
||||||
|
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
||||||
|
setlocal formatprg=
|
||||||
|
setlocal grepprg=
|
||||||
|
setlocal iminsert=0
|
||||||
|
setlocal imsearch=-1
|
||||||
|
setlocal include=
|
||||||
|
setlocal includeexpr=
|
||||||
|
setlocal indentexpr=
|
||||||
|
setlocal indentkeys=0{,0},:,0#,!^F,o,O,e
|
||||||
|
setlocal noinfercase
|
||||||
|
setlocal iskeyword=@,48-57,_,192-255
|
||||||
|
setlocal keywordprg=
|
||||||
|
setlocal nolinebreak
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal lispwords=
|
||||||
|
setlocal nolist
|
||||||
|
setlocal makeencoding=
|
||||||
|
setlocal makeprg=
|
||||||
|
setlocal matchpairs=(:),{:},[:]
|
||||||
|
setlocal nomodeline
|
||||||
|
setlocal modifiable
|
||||||
|
setlocal nrformats=bin,hex
|
||||||
|
setlocal nonumber
|
||||||
|
setlocal numberwidth=4
|
||||||
|
setlocal omnifunc=
|
||||||
|
setlocal path=
|
||||||
|
setlocal nopreserveindent
|
||||||
|
setlocal nopreviewwindow
|
||||||
|
setlocal quoteescape=\\
|
||||||
|
setlocal noreadonly
|
||||||
|
setlocal norelativenumber
|
||||||
|
setlocal norightleft
|
||||||
|
setlocal rightleftcmd=search
|
||||||
|
setlocal noscrollbind
|
||||||
|
setlocal shiftwidth=8
|
||||||
|
setlocal noshortname
|
||||||
|
setlocal signcolumn=auto
|
||||||
|
setlocal nosmartindent
|
||||||
|
setlocal softtabstop=0
|
||||||
|
setlocal nospell
|
||||||
|
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
||||||
|
setlocal spellfile=
|
||||||
|
setlocal spelllang=en
|
||||||
|
setlocal statusline=
|
||||||
|
setlocal suffixesadd=
|
||||||
|
setlocal swapfile
|
||||||
|
setlocal synmaxcol=3000
|
||||||
|
if &syntax != 'dosini'
|
||||||
|
setlocal syntax=dosini
|
||||||
|
endif
|
||||||
|
setlocal tabstop=8
|
||||||
|
setlocal tagcase=
|
||||||
|
setlocal tags=
|
||||||
|
setlocal termkey=
|
||||||
|
setlocal termsize=
|
||||||
|
setlocal textwidth=0
|
||||||
|
setlocal thesaurus=
|
||||||
|
setlocal noundofile
|
||||||
|
setlocal undolevels=-123456
|
||||||
|
setlocal nowinfixheight
|
||||||
|
setlocal nowinfixwidth
|
||||||
|
setlocal wrap
|
||||||
|
setlocal wrapmargin=0
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 3 - ((2 * winheight(0) + 51) / 102)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
3
|
||||||
|
normal! 040|
|
||||||
|
tabedit main.py
|
||||||
|
set splitbelow splitright
|
||||||
|
set nosplitbelow
|
||||||
|
set nosplitright
|
||||||
|
wincmd t
|
||||||
|
set winminheight=1 winheight=1 winminwidth=1 winwidth=1
|
||||||
|
argglobal
|
||||||
|
setlocal keymap=
|
||||||
|
setlocal noarabic
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal backupcopy=
|
||||||
|
setlocal balloonexpr=
|
||||||
|
setlocal nobinary
|
||||||
|
setlocal nobreakindent
|
||||||
|
setlocal breakindentopt=
|
||||||
|
setlocal bufhidden=
|
||||||
|
setlocal buflisted
|
||||||
|
setlocal buftype=
|
||||||
|
setlocal nocindent
|
||||||
|
setlocal cinkeys=0{,0},0),:,!^F,o,O,e
|
||||||
|
setlocal cinoptions=
|
||||||
|
setlocal cinwords=if,else,while,do,for,switch
|
||||||
|
setlocal colorcolumn=
|
||||||
|
setlocal comments=b:#,fb:-
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
setlocal complete=.,w,b,u,t,i
|
||||||
|
setlocal concealcursor=
|
||||||
|
setlocal conceallevel=0
|
||||||
|
setlocal completefunc=
|
||||||
|
setlocal nocopyindent
|
||||||
|
setlocal cryptmethod=
|
||||||
|
setlocal nocursorbind
|
||||||
|
setlocal nocursorcolumn
|
||||||
|
setlocal nocursorline
|
||||||
|
setlocal define=
|
||||||
|
setlocal dictionary=
|
||||||
|
setlocal nodiff
|
||||||
|
setlocal equalprg=
|
||||||
|
setlocal errorformat=
|
||||||
|
setlocal expandtab
|
||||||
|
if &filetype != 'python'
|
||||||
|
setlocal filetype=python
|
||||||
|
endif
|
||||||
|
setlocal fixendofline
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
setlocal foldenable
|
||||||
|
setlocal foldexpr=0
|
||||||
|
setlocal foldignore=#
|
||||||
|
setlocal foldlevel=0
|
||||||
|
setlocal foldmarker={{{,}}}
|
||||||
|
setlocal foldmethod=manual
|
||||||
|
setlocal foldminlines=1
|
||||||
|
setlocal foldnestmax=20
|
||||||
|
setlocal foldtext=foldtext()
|
||||||
|
setlocal formatexpr=
|
||||||
|
setlocal formatoptions=tcq
|
||||||
|
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
||||||
|
setlocal formatprg=
|
||||||
|
setlocal grepprg=
|
||||||
|
setlocal iminsert=0
|
||||||
|
setlocal imsearch=-1
|
||||||
|
setlocal include=^\\s*\\(from\\|import\\)
|
||||||
|
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
|
||||||
|
setlocal indentexpr=GetPythonIndent(v:lnum)
|
||||||
|
setlocal indentkeys=0{,0},:,!^F,o,O,e,<:>,=elif,=except
|
||||||
|
setlocal noinfercase
|
||||||
|
setlocal iskeyword=@,48-57,_,192-255
|
||||||
|
setlocal keywordprg=
|
||||||
|
setlocal nolinebreak
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal lispwords=
|
||||||
|
setlocal nolist
|
||||||
|
setlocal makeencoding=
|
||||||
|
setlocal makeprg=
|
||||||
|
setlocal matchpairs=(:),{:},[:]
|
||||||
|
setlocal nomodeline
|
||||||
|
setlocal modifiable
|
||||||
|
setlocal nrformats=bin,hex
|
||||||
|
setlocal nonumber
|
||||||
|
setlocal numberwidth=4
|
||||||
|
setlocal omnifunc=python3complete#Complete
|
||||||
|
setlocal path=
|
||||||
|
setlocal nopreserveindent
|
||||||
|
setlocal nopreviewwindow
|
||||||
|
setlocal quoteescape=\\
|
||||||
|
setlocal readonly
|
||||||
|
setlocal norelativenumber
|
||||||
|
setlocal norightleft
|
||||||
|
setlocal rightleftcmd=search
|
||||||
|
setlocal noscrollbind
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
setlocal noshortname
|
||||||
|
setlocal signcolumn=auto
|
||||||
|
setlocal nosmartindent
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal nospell
|
||||||
|
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
||||||
|
setlocal spellfile=
|
||||||
|
setlocal spelllang=en
|
||||||
|
setlocal statusline=
|
||||||
|
setlocal suffixesadd=.py
|
||||||
|
setlocal swapfile
|
||||||
|
setlocal synmaxcol=3000
|
||||||
|
if &syntax != 'python'
|
||||||
|
setlocal syntax=python
|
||||||
|
endif
|
||||||
|
setlocal tabstop=8
|
||||||
|
setlocal tagcase=
|
||||||
|
setlocal tags=
|
||||||
|
setlocal termkey=
|
||||||
|
setlocal termsize=
|
||||||
|
setlocal textwidth=0
|
||||||
|
setlocal thesaurus=
|
||||||
|
setlocal noundofile
|
||||||
|
setlocal undolevels=-123456
|
||||||
|
setlocal nowinfixheight
|
||||||
|
setlocal nowinfixwidth
|
||||||
|
setlocal wrap
|
||||||
|
setlocal wrapmargin=0
|
||||||
|
silent! normal! zE
|
||||||
|
let s:l = 1 - ((0 * winheight(0) + 51) / 102)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
exe s:l
|
||||||
|
normal! zt
|
||||||
|
1
|
||||||
|
normal! 0
|
||||||
|
tabnext 2
|
||||||
|
set stal=1
|
||||||
|
if exists('s:wipebuf')
|
||||||
|
silent exe 'bwipe ' . s:wipebuf
|
||||||
|
endif
|
||||||
|
unlet! s:wipebuf
|
||||||
|
set winheight=1 winwidth=20 shortmess=filnxtToO
|
||||||
|
set winminheight=1 winminwidth=1
|
||||||
|
let s:sx = expand("<sfile>:p:r")."x.vim"
|
||||||
|
if file_readable(s:sx)
|
||||||
|
exe "source " . fnameescape(s:sx)
|
||||||
|
endif
|
||||||
|
let &so = s:so_save | let &siso = s:siso_save
|
||||||
|
doautoall SessionLoadPost
|
||||||
|
unlet SessionLoad
|
||||||
|
" vim: set ft=vim :
|
125
worker.py
125
worker.py
@ -65,28 +65,46 @@ class MessageWorker:
|
|||||||
print("Lexer is defined as %s" % lexer)
|
print("Lexer is defined as %s" % lexer)
|
||||||
if lexer.name == 'Text only':
|
if lexer.name == 'Text only':
|
||||||
lexer = get_lexer_by_name('python')
|
lexer = get_lexer_by_name('python')
|
||||||
try:
|
print(highlight(code, lexer, ImageFormatter(
|
||||||
highlight(code, lexer, ImageFormatter(
|
|
||||||
font_size=16,
|
font_size=16,
|
||||||
line_number_bg="#242e0c",
|
line_number_bg="#242e0c",
|
||||||
line_number_fg="#faddf2",
|
line_number_fg="#faddf2",
|
||||||
line_number_bold=True,
|
line_number_bold=True,
|
||||||
font_name='DejaVuSansMono',
|
font_name='DejaVuSansMono',
|
||||||
style=get_style_by_name('monokai')), outfile="code.png")
|
style=get_style_by_name('monokai')), outfile="code.png"))
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
return e
|
|
||||||
|
|
||||||
def handleUpdate(self, msg):
|
def handleUpdate(self, msg):
|
||||||
try:
|
|
||||||
try:
|
try:
|
||||||
input_message = msg['message']['text']
|
input_message = msg['message']['text']
|
||||||
|
if input_message == '/help':
|
||||||
|
conf_id = msg['message']['chat']['id']
|
||||||
|
user_id = msg['message']['from']['id']
|
||||||
|
if msg['message']['chat']['type'] == 'private':
|
||||||
|
chat_title = conf_id
|
||||||
|
else:
|
||||||
|
chat_title = msg['message']['chat']['title']
|
||||||
|
self.db.add_conf(conf_id, chat_title)
|
||||||
|
msg = """
|
||||||
|
Commands:
|
||||||
|
@here - call all conf users
|
||||||
|
/stat - show user stat
|
||||||
|
/scheme - print sql schema
|
||||||
|
/reset - reset user stat
|
||||||
|
/sql - execute sql
|
||||||
|
/alert - set alert
|
||||||
|
/code - highlight code snippet
|
||||||
|
"""
|
||||||
|
self.send(id=conf_id, msg=msg)
|
||||||
if ('@here' in input_message) or (' @'+self.me['result']['username'] in input_message):
|
if ('@here' in input_message) or (' @'+self.me['result']['username'] in input_message):
|
||||||
if str(msg['message']['chat']['id']) != "-1001233797421":
|
if str(msg['message']['chat']['id']) != "-1001233797421":
|
||||||
print("@here isn't available for '%s' (%s)" % (msg['message']['chat']['title'], msg['message']['chat']['id']))
|
print("@here isn't available for '%s' (%s)" % (msg['message']['chat']['title'], msg['message']['chat']['id']))
|
||||||
return
|
return
|
||||||
conf_id = msg['message']['chat']['id']
|
conf_id = msg['message']['chat']['id']
|
||||||
user_id = msg['message']['from']['id']
|
user_id = msg['message']['from']['id']
|
||||||
|
if msg['message']['chat']['type'] == 'private':
|
||||||
|
chat_title = conf_id
|
||||||
|
else:
|
||||||
chat_title = msg['message']['chat']['title']
|
chat_title = msg['message']['chat']['title']
|
||||||
self.db.add_conf(conf_id, chat_title)
|
self.db.add_conf(conf_id, chat_title)
|
||||||
if msg['message']['text'] != '@here':
|
if msg['message']['text'] != '@here':
|
||||||
@ -107,39 +125,51 @@ class MessageWorker:
|
|||||||
'@' + self.me['result']['username'], '')
|
'@' + self.me['result']['username'], '')
|
||||||
except:
|
except:
|
||||||
input_message = msg['message']['text']
|
input_message = msg['message']['text']
|
||||||
if str(msg['message']['chat']['id']) == "-1001233797421":
|
# if str(msg['message']['chat']['id']) == "-1001233797421":
|
||||||
if random.randint(0,300) == 1:
|
# if random.randint(0,300) == 1:
|
||||||
conf_id = msg['message']['chat']['id']
|
# conf_id = msg['message']['chat']['id']
|
||||||
user_id = msg['message']['from']['id']
|
# user_id = msg['message']['from']['id']
|
||||||
chat_title = msg['message']['chat']['title']
|
# if msg['message']['chat']['type'] == 'private':
|
||||||
self.db.add_conf(conf_id, chat_title)
|
# chat_title = conf_id
|
||||||
word_aya = self.db.get_random_word(count=1, like="%ая")
|
# else:
|
||||||
word_da = self.db.get_random_word(count=1, like="%да")
|
# chat_title = msg['message']['chat']['title']
|
||||||
msg = "Ты %s %s." % (word_aya[0][0], word_da[0][0])
|
# self.db.add_conf(conf_id, chat_title)
|
||||||
self.send(id=conf_id, msg=msg)
|
# word_aya = self.db.get_random_word(count=1, like="%ая")
|
||||||
if (input_message[0] == 'я') or (input_message[0] == 'Я'):
|
# word_da = self.db.get_random_word(count=1, like="%да")
|
||||||
if len(input_message) > 3:
|
# msg = "Ты %s %s." % (word_aya[0][0], word_da[0][0])
|
||||||
conf_id = msg['message']['chat']['id']
|
# self.send(id=conf_id, msg=msg)
|
||||||
user_id = msg['message']['from']['id']
|
# if (input_message[0] == 'я') or (input_message[0] == 'Я'):
|
||||||
chat_title = msg['message']['chat']['title']
|
# if len(input_message) > 3:
|
||||||
self.db.add_conf(conf_id, chat_title)
|
# conf_id = msg['message']['chat']['id']
|
||||||
answers = ['И чо бля?','Да и похуй.','Ну и хуй с тобой.','Нет я.']
|
# user_id = msg['message']['from']['id']
|
||||||
if random.randint(0,100) > 80:
|
# if msg['message']['chat']['type'] == 'private':
|
||||||
msg = answers[random.randint(0,len(answers)-1)]
|
# chat_title = conf_id
|
||||||
self.send(id=conf_id, msg=msg)
|
# else:
|
||||||
if (input_message[0:1] == 'Ты') or (input_message[0:1] == 'ты'):
|
# chat_title = msg['message']['chat']['title']
|
||||||
if len(input_message) > 5:
|
# self.db.add_conf(conf_id, chat_title)
|
||||||
conf_id = msg['message']['chat']['id']
|
# answers = ['И чо бля?','Да и похуй.','Ну и хуй с тобой.','Нет я.']
|
||||||
user_id = msg['message']['from']['id']
|
# if random.randint(0,100) > 80:
|
||||||
chat_title = msg['message']['chat']['title']
|
# msg = answers[random.randint(0,len(answers)-1)]
|
||||||
self.db.add_conf(conf_id, chat_title)
|
# self.send(id=conf_id, msg=msg)
|
||||||
answers = ['Двачую.','Да.', 'А я покакал.', "Винда лучше."]
|
# if (input_message[0:1] == 'Ты') or (input_message[0:1] == 'ты'):
|
||||||
if random.randint(0,100) > 70:
|
# if len(input_message) > 5:
|
||||||
msg = answers[random.randint(0,len(answers)-1)]
|
# conf_id = msg['message']['chat']['id']
|
||||||
self.send(id=conf_id, msg=msg)
|
# user_id = msg['message']['from']['id']
|
||||||
|
# if msg['message']['chat']['type'] == 'private':
|
||||||
|
# chat_title = conf_id
|
||||||
|
# else:
|
||||||
|
# chat_title = msg['message']['chat']['title']
|
||||||
|
# self.db.add_conf(conf_id, chat_title)
|
||||||
|
# answers = ['Двачую.','Да.', 'А я покакал.', "Винда лучше."]
|
||||||
|
# if random.randint(0,100) > 70:
|
||||||
|
# msg = answers[random.randint(0,len(answers)-1)]
|
||||||
|
# self.send(id=conf_id, msg=msg)
|
||||||
if input_message == '/scheme':
|
if input_message == '/scheme':
|
||||||
conf_id = msg['message']['chat']['id']
|
conf_id = msg['message']['chat']['id']
|
||||||
user_id = msg['message']['from']['id']
|
user_id = msg['message']['from']['id']
|
||||||
|
if msg['message']['chat']['type'] == 'private':
|
||||||
|
chat_title = conf_id
|
||||||
|
else:
|
||||||
chat_title = msg['message']['chat']['title']
|
chat_title = msg['message']['chat']['title']
|
||||||
self.db.add_conf(conf_id, chat_title)
|
self.db.add_conf(conf_id, chat_title)
|
||||||
self.send(id=conf_id, msg='```\n' + self.db.scheme + '\n```')
|
self.send(id=conf_id, msg='```\n' + self.db.scheme + '\n```')
|
||||||
@ -148,6 +178,9 @@ class MessageWorker:
|
|||||||
if input_message == '/stat':
|
if input_message == '/stat':
|
||||||
conf_id = msg['message']['chat']['id']
|
conf_id = msg['message']['chat']['id']
|
||||||
user_id = msg['message']['from']['id']
|
user_id = msg['message']['from']['id']
|
||||||
|
if msg['message']['chat']['type'] == 'private':
|
||||||
|
chat_title = conf_id
|
||||||
|
else:
|
||||||
chat_title = msg['message']['chat']['title']
|
chat_title = msg['message']['chat']['title']
|
||||||
self.db.add_conf(conf_id, chat_title)
|
self.db.add_conf(conf_id, chat_title)
|
||||||
|
|
||||||
@ -164,6 +197,9 @@ class MessageWorker:
|
|||||||
if input_message == '/reset':
|
if input_message == '/reset':
|
||||||
conf_id = msg['message']['chat']['id']
|
conf_id = msg['message']['chat']['id']
|
||||||
user_id = msg['message']['from']['id']
|
user_id = msg['message']['from']['id']
|
||||||
|
if msg['message']['chat']['type'] == 'private':
|
||||||
|
chat_title = conf_id
|
||||||
|
else:
|
||||||
chat_title = msg['message']['chat']['title']
|
chat_title = msg['message']['chat']['title']
|
||||||
self.db.add_conf(conf_id, chat_title)
|
self.db.add_conf(conf_id, chat_title)
|
||||||
|
|
||||||
@ -176,6 +212,9 @@ class MessageWorker:
|
|||||||
if input_message[:4] == '/sql':
|
if input_message[:4] == '/sql':
|
||||||
conf_id = msg['message']['chat']['id']
|
conf_id = msg['message']['chat']['id']
|
||||||
user_id = msg['message']['from']['id']
|
user_id = msg['message']['from']['id']
|
||||||
|
if msg['message']['chat']['type'] == 'private':
|
||||||
|
chat_title = conf_id
|
||||||
|
else:
|
||||||
chat_title = msg['message']['chat']['title']
|
chat_title = msg['message']['chat']['title']
|
||||||
self.db.add_conf(conf_id, chat_title)
|
self.db.add_conf(conf_id, chat_title)
|
||||||
sql = msg['message']['text'][5:]
|
sql = msg['message']['text'][5:]
|
||||||
@ -199,6 +238,9 @@ class MessageWorker:
|
|||||||
if input_message[:6] == '/alert':
|
if input_message[:6] == '/alert':
|
||||||
conf_id = msg['message']['chat']['id']
|
conf_id = msg['message']['chat']['id']
|
||||||
user_id = msg['message']['from']['id']
|
user_id = msg['message']['from']['id']
|
||||||
|
if msg['message']['chat']['type'] == 'private':
|
||||||
|
chat_title = conf_id
|
||||||
|
else:
|
||||||
chat_title = msg['message']['chat']['title']
|
chat_title = msg['message']['chat']['title']
|
||||||
self.db.add_conf(conf_id, chat_title)
|
self.db.add_conf(conf_id, chat_title)
|
||||||
msg = msg['message']['text'].split()[1:]
|
msg = msg['message']['text'].split()[1:]
|
||||||
@ -213,6 +255,9 @@ class MessageWorker:
|
|||||||
# codefunc
|
# codefunc
|
||||||
conf_id = msg['message']['chat']['id']
|
conf_id = msg['message']['chat']['id']
|
||||||
user_id = msg['message']['from']['id']
|
user_id = msg['message']['from']['id']
|
||||||
|
if msg['message']['chat']['type'] == 'private':
|
||||||
|
chat_title = conf_id
|
||||||
|
else:
|
||||||
chat_title = msg['message']['chat']['title']
|
chat_title = msg['message']['chat']['title']
|
||||||
self.db.add_conf(conf_id, chat_title)
|
self.db.add_conf(conf_id, chat_title)
|
||||||
if len(msg['message']['text'][6:]) < 10000:
|
if len(msg['message']['text'][6:]) < 10000:
|
||||||
@ -222,9 +267,6 @@ class MessageWorker:
|
|||||||
print(e)
|
print(e)
|
||||||
self.send_img(conf_id)
|
self.send_img(conf_id)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
|
||||||
print('ERROR: %s' % e)
|
|
||||||
return False
|
|
||||||
try:
|
try:
|
||||||
text = msg['message']['text']
|
text = msg['message']['text']
|
||||||
try:
|
try:
|
||||||
@ -241,6 +283,9 @@ class MessageWorker:
|
|||||||
first_name = '_null'
|
first_name = '_null'
|
||||||
user_id = msg['message']['from']['id']
|
user_id = msg['message']['from']['id']
|
||||||
chat_id = msg['message']['chat']['id']
|
chat_id = msg['message']['chat']['id']
|
||||||
|
if msg['message']['chat']['type'] == 'private':
|
||||||
|
chat_title = chat_id
|
||||||
|
else:
|
||||||
chat_title = msg['message']['chat']['title']
|
chat_title = msg['message']['chat']['title']
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
Reference in New Issue
Block a user