1
0
Fork 0

Initial commit.

This commit is contained in:
Casper V. Kristensen 2018-12-15 15:32:51 +01:00
commit 0b06f00032
Signed by: caspervk
GPG key ID: 289CA03790535054
4 changed files with 302 additions and 0 deletions

207
.gitignore vendored Normal file
View file

@ -0,0 +1,207 @@
# Created by https://www.gitignore.io/api/python,pycharm+all
# Edit at https://www.gitignore.io/?templates=python,pycharm+all
### PyCharm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### PyCharm+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
.idea/
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
### Python Patch ###
.venv/
# End of https://www.gitignore.io/api/python,pycharm+all

32
README.md Normal file
View file

@ -0,0 +1,32 @@
## Setup
```bash
# Install Sopel
sudo apt install sopel
# Go through the setup wizard
sopel
# Install custom modules
git clone https://git.caspervk.net/caspervk/sopel-modules.git ~/.sopel/modules
```
## Example default.cfg
```ini
[core]
host = example.com
port = 6697
use_ssl = true
verify_ssl = true
nick = goodbot
owner = caspervk
prefix = \.
help_prefix = .
channels = #chat
default_timezone = Europe/Copenhagen
reply_errors = false
enable = admin,announce,calc,clock,countdown,currency,dice,find,help,ip,isup,rand,reload,remind,seen,units,uptime,version,weather,wikipedia,wiktionary,emoticons,tor
[admin]
hold_ground = true
auto_accept_invite = true
```

31
emoticons.py Normal file
View file

@ -0,0 +1,31 @@
from sopel.module import commands
@commands("shrug", "we")
def shrug(bot, trigger):
bot.say("¯\_(ツ)_/¯")
@commands("lenny", "lf")
def lenny(bot, trigger):
bot.say("( ͡° ͜ʖ ͡°)")
@commands("ohgod", "ld")
def ohgod(bot, trigger):
bot.say("ಠ_ಠ")
@commands("flip", "tf", "ft")
def flip(bot, trigger):
bot.say("(╯°□°)╯︵ ┻━┻")
@commands("unflip")
def unflip(bot, trigger):
bot.say("┬┬ ( ゜-゜ノ)")
@commands("e")
def e(bot, trigger):
bot.reply(".e is deprecated, please use .{} instead".format(trigger.group(2)))

32
tor.py Normal file
View file

@ -0,0 +1,32 @@
from urllib.request import urlopen
from sopel.module import commands
def get_stats():
r = urlopen("http://tor.caspervk.net:44313/vnstat").read().decode()
values = r.strip().split(";")
keys = ("version",
"interface",
"today_timestamp",
"today_rx",
"today_tx",
"today_total",
"today_avgrate",
"month_timestamp",
"month_rx",
"month_tx",
"month_total",
"month_avgrate",
"total_rx",
"total_tx",
"total_total")
return dict(zip(keys, values))
@commands("tor")
def tor(bot, trigger):
stats = get_stats()
bot.say("Relay statistics for today: {today_rx} received, {today_tx} transmitted for a total of {today_total} at an average rate of {today_avgrate}".format(**stats))
bot.say("Relay statistics for month: {month_rx} received, {month_tx} transmitted for a total of {month_total} at an average rate of {month_avgrate}".format(**stats))
bot.say("Relay statistics totals: {total_rx} received, {total_tx} transmitted for a total of {total_total}".format(**stats))