mirror of
https://gitlab.com/octospacc/WinDog.git
synced 2025-06-05 22:09:20 +02:00
Add first fun commands
This commit is contained in:
0
Locale/en.json
Executable file → Normal file
0
Locale/en.json
Executable file → Normal file
70
Locale/it.json
Executable file → Normal file
70
Locale/it.json
Executable file → Normal file
@ -3,11 +3,11 @@
|
|||||||
"Ciao {user.mention_markdown_v2()}!"
|
"Ciao {user.mention_markdown_v2()}!"
|
||||||
],
|
],
|
||||||
"help": [
|
"help": [
|
||||||
"Non c'è nessuno qui ad aiutarti (per ora)."
|
"*Non c'è nessuno qui ad aiutarti (per ora).*"
|
||||||
],
|
],
|
||||||
"echo": {
|
"echo": {
|
||||||
"empty": [
|
"empty": [
|
||||||
"Echo cosa? Dimmi qualcosa da ripetere."
|
"*Echo cosa? Dimmi qualcosa da ripetere.*"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"wish": {
|
"wish": {
|
||||||
@ -20,12 +20,70 @@
|
|||||||
},
|
},
|
||||||
"hug": {
|
"hug": {
|
||||||
"empty": [
|
"empty": [
|
||||||
|
"*Chi vuoi abbracciare? Rispondi a qualcuno.*",
|
||||||
"*Un abbraccio a chi? Non hai risposto a nessuno...*"
|
"*Un abbraccio a chi? Non hai risposto a nessuno...*"
|
||||||
],
|
],
|
||||||
"bot": [],
|
"bot": [
|
||||||
"self": [],
|
"*...Grazie uwu <3*",
|
||||||
|
"*Non puoi abbracciarmi ☁️ :/*"
|
||||||
|
],
|
||||||
|
"self": [
|
||||||
|
"*{0} allunga le braccia attorno a sè, si stringe forte, e si sente ora meno triste.*"
|
||||||
|
],
|
||||||
"others": [
|
"others": [
|
||||||
"*{0} abbraccia {1} forte forte... :3*"
|
"*{0} abbraccia {1} forte forte... :3*",
|
||||||
|
"*{0} ti ha dato un abbraccio!*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pat": {
|
||||||
|
"empty": [
|
||||||
|
"*Chi vuoi accarezzare? Rispondi a qualcuno.*",
|
||||||
|
"*Una carezza a chi? Non hai risposto a nessuno...*"
|
||||||
|
],
|
||||||
|
"bot": [
|
||||||
|
"*Rawrrr xDDdd*",
|
||||||
|
"*Come vuoi accarezzarmi? Vivo nel cloud... :(*"
|
||||||
|
],
|
||||||
|
"self": [
|
||||||
|
"*{0} allunga goffamente la mano dietro di sè per accarezzarsi in testa 🙃*"
|
||||||
|
],
|
||||||
|
"others": [
|
||||||
|
"*{0} fa patpat a {1} ^.^*",
|
||||||
|
"*{0} ti accarezza con dolcezza.*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"poke": {
|
||||||
|
"empty": [
|
||||||
|
"*Chi vuoi punzecchiare? Rispondi a qualcuno.*",
|
||||||
|
"*Punzecchiare chi? Non hai risposto a nessuno...*"
|
||||||
|
],
|
||||||
|
"bot": [
|
||||||
|
"*>_< perché?*",
|
||||||
|
"*heh ☁️😌*"
|
||||||
|
],
|
||||||
|
"self": [
|
||||||
|
"*{0} si punzecchia :o*"
|
||||||
|
],
|
||||||
|
"others": [
|
||||||
|
"*{0} punzecchia {1} 👀*",
|
||||||
|
"*{0} ti punzecchia con impertinenza 👉*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cuddle": {
|
||||||
|
"empty": [
|
||||||
|
"*A chi vuoi fare le coccole? Rispondi a qualcuno.*",
|
||||||
|
"*Le coccole? A chi? Non hai risposto a nessuno...*"
|
||||||
|
],
|
||||||
|
"bot": [
|
||||||
|
"*Aww.. grazie :3*",
|
||||||
|
"*Vorrei anche io le coccole ma... ☁️😔*"
|
||||||
|
],
|
||||||
|
"self": [
|
||||||
|
"{0} si stende sul letto e prova a farsi le coccole, per sentirsi meglio."
|
||||||
|
],
|
||||||
|
"others": [
|
||||||
|
"*{0} fa le coccole a {1} 🥰*",
|
||||||
|
"*{0} ti fa le coccole!*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
73
WinDog.py
73
WinDog.py
@ -2,18 +2,25 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
from random import choice, randint
|
from random import choice, randint
|
||||||
from telegram import Update, ForceReply
|
from telegram import Update, ForceReply, Bot
|
||||||
|
from telegram.utils.helpers import escape_markdown
|
||||||
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext
|
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext
|
||||||
from Config import *
|
from Config import *
|
||||||
|
|
||||||
Private = {}
|
Private = {}
|
||||||
Locale = {}
|
Locale = {}
|
||||||
|
|
||||||
def MDSanitize(String, Exclude=[]):
|
def CharEscape(String, Escape=''):
|
||||||
for c in ['!', '.']:
|
if Escape == 'MARKDOWN':
|
||||||
if c not in Exclude:
|
return escape_markdown(String, version=2)
|
||||||
|
elif Escape == 'MARKDOWN_SPEECH':
|
||||||
|
for c in '.!()[]':
|
||||||
String = String.replace(c, '\\'+c)
|
String = String.replace(c, '\\'+c)
|
||||||
return String
|
return String
|
||||||
|
else:
|
||||||
|
for c in Escape:
|
||||||
|
String = String.replace(c, '\\'+c)
|
||||||
|
return String
|
||||||
|
|
||||||
def start(update:Update, context:CallbackContext) -> None:
|
def start(update:Update, context:CallbackContext) -> None:
|
||||||
if CmdRestrict(update):
|
if CmdRestrict(update):
|
||||||
@ -25,25 +32,25 @@ def start(update:Update, context:CallbackContext) -> None:
|
|||||||
|
|
||||||
def help(update:Update, context:CallbackContext) -> None:
|
def help(update:Update, context:CallbackContext) -> None:
|
||||||
if CmdRestrict(update):
|
if CmdRestrict(update):
|
||||||
update.message.reply_text(
|
update.message.reply_markdown_v2(
|
||||||
choice(Locale[Lang]['help']),
|
CharEscape(choice(Locale[Lang]['help']), '.!()'),
|
||||||
reply_to_message_id=update.message.message_id)
|
reply_to_message_id=update.message.message_id)
|
||||||
|
|
||||||
def echo(update:Update, context:CallbackContext) -> None:
|
def echo(update:Update, context:CallbackContext) -> None:
|
||||||
if CmdRestrict(update):
|
if CmdRestrict(update):
|
||||||
Message = update.message.text
|
Message = update.message.text
|
||||||
if Message.lower()[1:] == 'echo':
|
if Message.lower()[1:] == 'echo':
|
||||||
Text = choice(Locale[Lang]['echo']['empty'])
|
Text = CharEscape(choice(Locale[Lang]['echo']['empty']), '.!')
|
||||||
else:
|
else:
|
||||||
Text = Message[5:]
|
Text = Message[5:]
|
||||||
update.message.reply_text(
|
update.message.reply_markdown_v2(
|
||||||
Text,
|
Text,
|
||||||
reply_to_message_id=update.message.message_id)
|
reply_to_message_id=update.message.message_id)
|
||||||
|
|
||||||
def ping(update:Update, context:CallbackContext) -> None:
|
def ping(update:Update, context:CallbackContext) -> None:
|
||||||
if CmdRestrict(update):
|
if CmdRestrict(update):
|
||||||
update.message.reply_text(
|
update.message.reply_markdown_v2(
|
||||||
'Pong!',
|
'*Pong\!*',
|
||||||
reply_to_message_id=update.message.message_id)
|
reply_to_message_id=update.message.message_id)
|
||||||
|
|
||||||
def wish(update:Update, context:CallbackContext) -> None:
|
def wish(update:Update, context:CallbackContext) -> None:
|
||||||
@ -53,22 +60,33 @@ def wish(update:Update, context:CallbackContext) -> None:
|
|||||||
else:
|
else:
|
||||||
Text = choice(Locale[Lang]['wish']['done'])
|
Text = choice(Locale[Lang]['wish']['done'])
|
||||||
update.message.reply_markdown_v2(
|
update.message.reply_markdown_v2(
|
||||||
MDSanitize(Text).format(randint(0,100)),
|
CharEscape(Text, '.!').format(str(randint(0,100))+'\.'+str(randint(0,9))+str(randint(0,9))),
|
||||||
reply_to_message_id=update.message.message_id)
|
reply_to_message_id=update.message.message_id)
|
||||||
|
|
||||||
def hug(update:Update, context:CallbackContext) -> None:
|
def multijoke(update:Update, context:CallbackContext) -> None:
|
||||||
if CmdRestrict(update):
|
if CmdRestrict(update):
|
||||||
|
Key = update.message.text.split(' ')[0][1:]
|
||||||
|
ReplyToMessage = update.message.message_id
|
||||||
if update.message.reply_to_message:
|
if update.message.reply_to_message:
|
||||||
FromUser = update.message.from_user.first_name.replace('.','\.')
|
ReplyFromUID = update.message.reply_to_message.from_user.id
|
||||||
ToUser = update.message.reply_to_message.from_user.first_name.replace('.','\.')
|
if ReplyFromUID == TGID:
|
||||||
Text = MDSanitize(choice(Locale[Lang]['hug']['others'])).format(FromUser,ToUser)
|
Text = CharEscape(choice(Locale[Lang][Key]['bot']), 'MARKDOWN_SPEECH')
|
||||||
|
elif ReplyFromUID == update.message.from_user.id:
|
||||||
|
FromUName = CharEscape(update.message.from_user.first_name, 'MARKDOWN')
|
||||||
|
Text = CharEscape(choice(Locale[Lang][Key]['self']), 'MARKDOWN_SPEECH').format(FromUName)
|
||||||
|
else:
|
||||||
|
FromUName = CharEscape(update.message.from_user.first_name, 'MARKDOWN')
|
||||||
|
ToUName = CharEscape(update.message.reply_to_message.from_user.first_name, 'MARKDOWN')
|
||||||
|
Text = CharEscape(choice(Locale[Lang][Key]['others']), 'MARKDOWN_SPEECH').format(FromUName,ToUName)
|
||||||
|
ReplyToMessage = update.message.reply_to_message.message_id
|
||||||
else:
|
else:
|
||||||
Text = MDSanitize(choice(Locale[Lang]['hug']['empty']))
|
Text = CharEscape(choice(Locale[Lang][Key]['empty']), 'MARKDOWN_SPEECH')
|
||||||
update.message.reply_markdown_v2(
|
update.message.reply_markdown_v2(
|
||||||
Text,
|
Text,
|
||||||
reply_to_message_id=update.message.message_id)
|
reply_to_message_id=ReplyToMessage)
|
||||||
|
|
||||||
def filters(update:Update, context:CallbackContext, Private) -> None:
|
|
||||||
|
def filters(update:Update, context:CallbackContext) -> None:
|
||||||
pass
|
pass
|
||||||
"""
|
"""
|
||||||
if CmdRestrict(update):
|
if CmdRestrict(update):
|
||||||
@ -81,7 +99,7 @@ def filters(update:Update, context:CallbackContext, Private) -> None:
|
|||||||
reply_to_message_id=update.message.message_id)
|
reply_to_message_id=update.message.message_id)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setfilter(update:Update, context:CallbackContext, Private) -> None:
|
def setfilter(update:Update, context:CallbackContext) -> None:
|
||||||
pass
|
pass
|
||||||
"""
|
"""
|
||||||
if CmdRestrict(update):
|
if CmdRestrict(update):
|
||||||
@ -129,18 +147,17 @@ def main() -> None:
|
|||||||
dispatcher.add_handler(CommandHandler("echo", echo))
|
dispatcher.add_handler(CommandHandler("echo", echo))
|
||||||
dispatcher.add_handler(CommandHandler("ping", ping))
|
dispatcher.add_handler(CommandHandler("ping", ping))
|
||||||
dispatcher.add_handler(CommandHandler("wish", wish))
|
dispatcher.add_handler(CommandHandler("wish", wish))
|
||||||
dispatcher.add_handler(CommandHandler("hug", hug))
|
dispatcher.add_handler(CommandHandler("hug", multijoke))
|
||||||
#dispatcher.add_handler(CommandHandler("pat", pat))
|
dispatcher.add_handler(CommandHandler("pat", multijoke))
|
||||||
#dispatcher.add_handler(CommandHandler("poke", poke))
|
dispatcher.add_handler(CommandHandler("poke", multijoke))
|
||||||
#dispatcher.add_handler(CommandHandler("cuddle", cuddle))
|
dispatcher.add_handler(CommandHandler("cuddle", multijoke))
|
||||||
#dispatcher.add_handler(CommandHandler("setfilter", setfilter))
|
#dispatcher.add_handler(CommandHandler("setfilter", setfilter))
|
||||||
dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, filters, Private))
|
dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, filters))
|
||||||
|
|
||||||
print('Starting bot...')
|
print('Starting WinDog...')
|
||||||
updater.start_polling()
|
updater.start_polling()
|
||||||
|
|
||||||
updater.idle()
|
updater.idle()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
print('Closing...')
|
print('Closing WinDog...')
|
||||||
|
Reference in New Issue
Block a user