-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
397 additions
and
644 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# ~/.bashrc: executed by bash(1) for non-login shells. | ||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | ||
# for examples | ||
|
||
# If not running interactively, don't do anything | ||
case $- in | ||
*i*) ;; | ||
*) return;; | ||
esac | ||
|
||
# don't put duplicate lines or lines starting with space in the history. | ||
# See bash(1) for more options | ||
HISTCONTROL=ignoreboth | ||
|
||
# append to the history file, don't overwrite it | ||
shopt -s histappend | ||
|
||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | ||
HISTSIZE=1000 | ||
HISTFILESIZE=2000 | ||
|
||
# check the window size after each command and, if necessary, | ||
# update the values of LINES and COLUMNS. | ||
shopt -s checkwinsize | ||
|
||
# If set, the pattern "**" used in a pathname expansion context will | ||
# match all files and zero or more directories and subdirectories. | ||
#shopt -s globstar | ||
|
||
# make less more friendly for non-text input files, see lesspipe(1) | ||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | ||
|
||
# set variable identifying the chroot you work in (used in the prompt below) | ||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | ||
debian_chroot=$(cat /etc/debian_chroot) | ||
fi | ||
|
||
# set a fancy prompt (non-color, unless we know we "want" color) | ||
case "$TERM" in | ||
xterm-color|*-256color) color_prompt=yes;; | ||
esac | ||
|
||
# uncomment for a colored prompt, if the terminal has the capability; turned | ||
# off by default to not distract the user: the focus in a terminal window | ||
# should be on the output of commands, not on the prompt | ||
#force_color_prompt=yes | ||
|
||
if [ -n "$force_color_prompt" ]; then | ||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | ||
# We have color support; assume it's compliant with Ecma-48 | ||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such | ||
# a case would tend to support setf rather than setaf.) | ||
color_prompt=yes | ||
else | ||
color_prompt= | ||
fi | ||
fi | ||
if [ "$color_prompt" = yes ]; then | ||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@${PROJECT_NAME}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | ||
else | ||
PS1='${debian_chroot:+($debian_chroot)}\u@${PROJECT_NAME}:\w\$ ' | ||
fi | ||
unset color_prompt force_color_prompt | ||
# If this is an xterm set the title to user@host:dir | ||
case "$TERM" in | ||
xterm*|rxvt*) | ||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" | ||
;; | ||
*) | ||
;; | ||
esac | ||
# enable color support of ls and also add handy aliases | ||
if [ -x /usr/bin/dircolors ]; then | ||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | ||
alias ls='ls --color=auto' | ||
#alias dir='dir --color=auto' | ||
#alias vdir='vdir --color=auto' | ||
alias grep='grep --color=auto' | ||
alias fgrep='fgrep --color=auto' | ||
alias egrep='egrep --color=auto' | ||
fi | ||
# colored GCC warnings and errors | ||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' | ||
# some more ls aliases | ||
alias ll='ls -alF' | ||
alias la='ls -A' | ||
alias l='ls -CF' | ||
# Add an "alert" alias for long running commands. Use like so: | ||
# sleep 10; alert | ||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s | ||
/[;&|]\s*alert$//'\'')"' | ||
# Alias definitions. | ||
# You may want to put all your additions into a separate file like | ||
# ~/.bash_aliases, instead of adding them here directly. | ||
# See /usr/share/doc/bash-doc/examples in the bash-doc package. | ||
if [ -f ~/.bash_aliases ]; then | ||
. ~/.bash_aliases | ||
fi | ||
# enable programmable completion features (you don't need to enable | ||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | ||
# sources /etc/bash.bashrc). | ||
if ! shopt -oq posix; then | ||
if [ -f /usr/share/bash-completion/bash_completion ]; then | ||
. /usr/share/bash-completion/bash_completion | ||
elif [ -f /etc/bash_completion ]; then | ||
. /etc/bash_completion | ||
fi | ||
fi | ||
export NVM_DIR="/home/nvm/.nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Environment Config | ||
|
||
# store your secrets and config variables in here | ||
# only invited collaborators will be able to see your .env values | ||
|
||
# reference these in your code with process.env.SECRET | ||
|
||
SECRET= | ||
MADE_WITH= | ||
TELEGRAM_TOKEN='[TELEGRAM BOT TOKEN]' | ||
# note: .env is a shell file so there can't be spaces around = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{"name":"drag-in-files.svg","date":"2016-10-22T16:17:49.954Z","url":"https://cdn.hyperdev.com/drag-in-files.svg","type":"image/svg","size":7646,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/drag-in-files.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(102, 153, 205)","uuid":"adSBq97hhhpFNUna"} | ||
{"name":"click-me.svg","date":"2016-10-23T16:17:49.954Z","url":"https://cdn.hyperdev.com/click-me.svg","type":"image/svg","size":7116,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/click-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(243, 185, 186)","uuid":"adSBq97hhhpFNUnb"} | ||
{"name":"paste-me.svg","date":"2016-10-24T16:17:49.954Z","url":"https://cdn.hyperdev.com/paste-me.svg","type":"image/svg","size":7242,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/paste-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(42, 179, 185)","uuid":"adSBq97hhhpFNUnc"} | ||
{"name":"minionglitch.jpg","date":"2018-07-19T16:58:41.104Z","url":"https://cdn.glitch.com/57a8760f-98b2-4990-b2d1-13d10cf70263%2Fminionglitch.jpg","type":"image/jpeg","size":6211,"imageWidth":225,"imageHeight":225,"thumbnail":"https://cdn.glitch.com/57a8760f-98b2-4990-b2d1-13d10cf70263%2Fminionglitch.jpg","thumbnailWidth":225,"thumbnailHeight":225,"dominantColor":"rgb(252,252,252)","uuid":"J2890N0e8rd4YFnD"} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# ~/.profile: executed by the command interpreter for login shells. | ||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login | ||
# exists. | ||
# see /usr/share/doc/bash/examples/startup-files for examples. | ||
# the files are located in the bash-doc package. | ||
# the default umask is set in /etc/profile; for setting the umask | ||
# for ssh logins, install and configure the libpam-umask package. | ||
#umask 022 | ||
# if running bash | ||
if [ -n "$BASH_VERSION" ]; then | ||
# include .bashrc if it exists | ||
if [ -f "$HOME/.bashrc" ]; then | ||
. "$HOME/.bashrc" | ||
fi | ||
fi | ||
# set PATH so it includes user's private bin directories | ||
PATH="$HOME/bin:$HOME/.local/bin:$HOME/node_modules/.bin:$PATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Samuel Guibert | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
theme: jekyll-theme-cayman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
#Importaciones. | ||
import datetime | ||
import time | ||
|
||
############ EJEMPLO PARA ENTENDER COMO SE TRANSFORMA UNA FECHA A FECHA TIPO UNIX ########################################## | ||
## ## | ||
## dt = datetime.datetime(2018, 8, 21, 16, 00) #Ejemplo de una fecha. ## | ||
## unixTime = time.mktime(dt.timetuple()) #Conversión de esa fecha a Unix. ## | ||
## ## | ||
############################################################################################################################ | ||
|
||
#Función que recoge los parametros del tiempo asignado a un baneo y lo combierte al tiempo de sanción tiempo en formato Unix. | ||
def setTempBan(secB,minB,hourB,dayB,monthB,yearB): | ||
|
||
now = datetime.datetime.now() #Fecha de hoy. | ||
|
||
#Separamos por partes la fecha y LA hora de hoy | ||
HoyAno = now.year | ||
HoyMes = now.month | ||
HoyDia = now.day | ||
HoyHora = now.hour | ||
HoyMinuto = now.minute | ||
HoySegundo = now.second | ||
HoyMicrosegundo = now.microsecond | ||
|
||
#A continuación creamos nuevas variables para asignar la sanción de tiempo que queramos añadiendo los parámetros recogidos al principio de la función. | ||
banAno = HoyAno + yearB | ||
banMes = HoyMes + monthB | ||
banDia = HoyDia + dayB | ||
banHora = HoyHora + hourB | ||
banMinuto = HoyMinuto + minB | ||
banSegundo = HoySegundo + secB | ||
|
||
fechaBan = dt = datetime.datetime(banAno, banMes, banDia, banHora, banMinuto,banSegundo) # Al igual que en el ejemplo de arriba, añadimos los parametros de la feha. | ||
unixBan = time.mktime(fechaBan.timetuple()) #Convertimos la fecha del ban a Unix para luego asignarlo como parametro al baneo que hará el bot. | ||
|
||
print("fecha ban :" + str(fechaBan)) #Printeamos el resultado de la fecha del ban para asegurar que está bien. | ||
print(unixBan) #Printeamos el resultado de la fecha Unix del ban para asegurar que está bien. | ||
|
||
return unixBan #Devolvemos el valor del tiempo de la sanción del baneado en Unix. | ||
|
||
|
||
#Función para definir el tipo de muteo. | ||
def setTypeMute(typeMute): | ||
|
||
sendMessages = False | ||
sendMedia = False | ||
sendOtherMessages = False | ||
sendWebPage = False | ||
|
||
typeBanList = [["sendMessages",sendMessages],["sendMedia",sendMedia],["sendOtherMessages",sendOtherMessages],["sendWebPage",sendWebPage]] | ||
|
||
print(typeBanList) | ||
|
||
if typeMute == "all": | ||
print("Entramos en all") | ||
typeBanList = [ [x[0],True] if x[1] == False else x for x in typeBanList ] | ||
|
||
elif typeMute == "media": | ||
print("Entramos en media") | ||
typeBanList = [ [x[0],True] if x[0] == "sendMedia" else x for x in typeBanList ] | ||
|
||
elif typeMute == "other": | ||
print("Entramos en media") | ||
typeBanList = [ [x[0],True] if x[0] == "sendOtherMessages" else x for x in typeBanList ] | ||
|
||
elif typeMute == "web": | ||
print("Entramos en media") | ||
typeBanList = [ [x[0],True] if x[0] == "sendWebPage" else x for x in typeBanList ] | ||
|
||
elif typeMute == "message": | ||
print("Entramos en media") | ||
typeBanList = [ [x[0],True] if x[0] == "sendMessages" else x for x in typeBanList ] | ||
|
||
print(typeBanList) | ||
|
||
return typeBanList | ||
|
||
typeBan = setTypeMute("message") | ||
|
||
|
||
def banlevel(idChatGroup,idUser,level,typeMute): | ||
|
||
cid = idChatGroup | ||
idUsuario =idUser | ||
|
||
if level == 1 : | ||
|
||
typeMuteo = setTypeMute(typeMute) | ||
tiempoban = setTempBan(0,30,0,0,0,0) | ||
print("El usuario tiene un ban de nivel 1 " + str(idUsuario) + "estara baneado de: " + str(typeMuteo) + "con este tiempo: " + str(tiempoban) ) | ||
|
||
if level == 2 : | ||
|
||
typeMuteo = setTypeMute(typeMute) | ||
tiempoban = setTempBan(0,0,8,0,0,0) | ||
print("El usuario tiene un ban de nivel 2 " + str(idUsuario) + "estara baneado de: " + str(typeMuteo) + "con este tiempo: " + str(tiempoban) ) | ||
|
||
if level == 3 : | ||
|
||
typeMuteo = setTypeMute(typeMute) | ||
tiempoban = setTempBan(0,0,0,1,0,0) | ||
print("El usuario tiene un ban de nivel 3 " + str(idUsuario) + "estara baneado de: " + str(typeMuteo) + "con este tiempo: " + str(tiempoban) ) | ||
|
||
if level == 4 : | ||
|
||
typeMuteo = setTypeMute(typeMute) | ||
tiempoban = setTempBan(0,0,0,7,0,0) | ||
print("El usuario tiene un ban de nivel 4 " + str(idUsuario) + "estara baneado de: " + str(typeMuteo) + "con este tiempo: " + str(tiempoban) ) | ||
|
||
if level == 5 : | ||
|
||
typeMuteo = setTypeMute(typeMute) | ||
tiempoban = setTempBan(0,0,0,0,1,0) | ||
print("El usuario tiene un ban de nivel 5 " + str(idUsuario) + "estara baneado de: " + str(typeMuteo) + "con este tiempo: " + str(tiempoban) ) | ||
|
||
if level == 6 : | ||
|
||
typeMuteo = setTypeMute(typeMute) | ||
tiempoban = setTempBan(0,0,0,0,3,0) | ||
print("El usuario tiene un ban de nivel 6 " + str(idUsuario) + "estara baneado de: " + str(typeMuteo) + "con este tiempo: " + str(tiempoban) ) | ||
|
||
if level == 7 : | ||
|
||
typeMuteo = setTypeMute(typeMute) | ||
tiempoban = setTempBan(0,0,0,0,0,1) | ||
print("El usuario tiene un ban de nivel 7 " + str(idUsuario) + "estara baneado de: " + str(typeMuteo) + "con este tiempo: " + str(tiempoban) ) | ||
|
||
|
||
#Funcion para configurar el flood de cada grupo | ||
def antiFloodConfig(idChatGroup,numMessages,typeMute,timeBan): | ||
|
||
db_config = read_db_config() | ||
|
||
# prepare query and data | ||
query = """ UPDATE Group | ||
SET maxMessages = %s, mute = typeMute | ||
WHERE id = %s """ | ||
|
||
data = (title, book_id) | ||
|
||
try: | ||
conn = MySQLConnection(**db_config) | ||
|
||
# update book title | ||
cursor = conn.cursor() | ||
cursor.execute(query, data) | ||
|
||
# accept the changes | ||
conn.commit() | ||
|
||
except Error as error: | ||
print(error) | ||
|
||
finally: | ||
cursor.close() | ||
conn.close() | ||
|
||
banlevel(12312323,4121223,7,"media") | ||
|
Oops, something went wrong.