mirror of
https://github.com/Marsh232/Telegram-IP-CALC.git
synced 2025-07-03 08:15:42 +00:00
Отрефакторил, убрал конфиг в игнор
This commit is contained in:
parent
fd7e865b1a
commit
66e18240a0
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
# Distribution / packaging
|
||||||
|
bin/
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
# Unit test / coverage reports
|
||||||
|
.tox/
|
||||||
|
.coverage
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
# Mr Developer
|
||||||
|
.mr.developer.cfg
|
||||||
|
.project
|
||||||
|
.pydevproject
|
||||||
|
# Rope
|
||||||
|
.ropeproject
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
*.pot
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
config.json
|
6
.idea/Telegram-IP-CALC.iml
generated
6
.idea/Telegram-IP-CALC.iml
generated
@ -1,8 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$">
|
||||||
<orderEntry type="inheritedJdk" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.10 (Telegram-IP-CALC)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
6
.idea/copyright/SantaSpeen.xml
generated
Normal file
6
.idea/copyright/SantaSpeen.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value="Project: &#36;project.name Filename: &#36;file.fileName Create Date: &#36;today SantaSpeen Copyright (c) &#36;today.year" />
|
||||||
|
<option name="myName" value="SantaSpeen" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (Telegram-IP-CALC)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
47
.idea/workspace.xml
generated
47
.idea/workspace.xml
generated
@ -5,8 +5,14 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="56d3644b-12ed-4137-967a-9e3a3c12d93b" name="Changes" comment="Начал добовлять в телеграм 2">
|
<list default="true" id="56d3644b-12ed-4137-967a-9e3a3c12d93b" name="Changes" comment="Начал добовлять в телеграм 2">
|
||||||
|
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/copyright/SantaSpeen.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/Telegram-IP-CALC.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/Telegram-IP-CALC.iml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/config.py" beforeDir="false" afterPath="$PROJECT_DIR$/config.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/LICENSE" beforeDir="false" afterPath="$PROJECT_DIR$/LICENSE" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/config.py" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -35,20 +41,21 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"WebServerToolWindowFactoryState": "false",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"last_opened_file_path": "C:/Users/truno/Documents/GitHub/Telegram-IP-CALC",
|
"WebServerToolWindowFactoryState": "false",
|
||||||
"node.js.detected.package.eslint": "true",
|
"last_opened_file_path": "C:/Users/truno/Documents/GitHub/Telegram-IP-CALC",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"settings.editor.selected.configurable": "proofread"
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
|
"settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
|
||||||
}
|
}
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="RunManager" selected="Python.main">
|
<component name="RunManager" selected="Python.main">
|
||||||
<configuration name="main (2)" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
<configuration name="main (2)" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
@ -115,6 +122,7 @@
|
|||||||
<workItem from="1662886058001" duration="5482000" />
|
<workItem from="1662886058001" duration="5482000" />
|
||||||
<workItem from="1662931348193" duration="2714000" />
|
<workItem from="1662931348193" duration="2714000" />
|
||||||
<workItem from="1662934797487" duration="309000" />
|
<workItem from="1662934797487" duration="309000" />
|
||||||
|
<workItem from="1662979769296" duration="616000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Add basic output">
|
<task id="LOCAL-00001" summary="Add basic output">
|
||||||
<created>1662545492088</created>
|
<created>1662545492088</created>
|
||||||
@ -184,17 +192,6 @@
|
|||||||
<MESSAGE value="Начал добовлять в телеграм 2" />
|
<MESSAGE value="Начал добовлять в телеграм 2" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Начал добовлять в телеграм 2" />
|
<option name="LAST_COMMIT_MESSAGE" value="Начал добовлять в телеграм 2" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
|
||||||
<breakpoint-manager>
|
|
||||||
<breakpoints>
|
|
||||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
|
||||||
<url>file://$PROJECT_DIR$/main.py</url>
|
|
||||||
<line>52</line>
|
|
||||||
<option name="timeStamp" value="1" />
|
|
||||||
</line-breakpoint>
|
|
||||||
</breakpoints>
|
|
||||||
</breakpoint-manager>
|
|
||||||
</component>
|
|
||||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||||
<SUITE FILE_PATH="coverage/Telegram_IP_CALC$main.coverage" NAME="main Coverage Results" MODIFIED="1662935064255" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
<SUITE FILE_PATH="coverage/Telegram_IP_CALC$main.coverage" NAME="main Coverage Results" MODIFIED="1662935064255" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
|
1
LICENSE
1
LICENSE
@ -1,6 +1,7 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2022 Marsh232
|
Copyright (c) 2022 Marsh232
|
||||||
|
Copyright (c) 2022 SantaSpeen
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1 +1,4 @@
|
|||||||
# Telegram-IP-CALC
|
# Telegram-IP-CALC
|
||||||
|
|
||||||
|
Калькулятор для вычисления IP сетей. \
|
||||||
|
Бот в телеграм:
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
TOKEN = '5631324818:AAEcOp7ZPzeSQReLk7rwnAT89n76ld05Jko' # bot token
|
|
8
main.py
8
main.py
@ -1,11 +1,5 @@
|
|||||||
import config
|
|
||||||
import telebot
|
|
||||||
import ipaddress
|
import ipaddress
|
||||||
|
|
||||||
bot = telebot.TeleBot(config.TOKEN)
|
|
||||||
@bot.message_handler(commands=['start'])
|
|
||||||
def start(message):
|
|
||||||
bot.send_message(message.chat.id, 'Привет')
|
|
||||||
|
|
||||||
def main(ip):
|
def main(ip):
|
||||||
list_ip = ip.split('/') # Разделяет вводимый ip на часть с маской, и без
|
list_ip = ip.split('/') # Разделяет вводимый ip на часть с маской, и без
|
||||||
@ -45,9 +39,9 @@ def subnets(ip, prefix):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
bot.polling(none_stop=True)
|
|
||||||
addr = input('Введите ip: ') # Пользователь вводит ip
|
addr = input('Введите ip: ') # Пользователь вводит ip
|
||||||
main(addr)
|
main(addr)
|
||||||
|
exit(0)
|
||||||
# Тут должна быть кнопка типа "Подсети"
|
# Тут должна быть кнопка типа "Подсети"
|
||||||
new_prefix = input('\nВведите префикс: ')
|
new_prefix = input('\nВведите префикс: ')
|
||||||
subnets(addr, new_prefix)
|
subnets(addr, new_prefix)
|
Loading…
x
Reference in New Issue
Block a user