Renamed bitcoin plugin and added eth command
This commit is contained in:
parent
d0f38ca532
commit
432a2c9339
89
README.md
89
README.md
|
@ -1,29 +1,66 @@
|
||||||
* [x] .btc - prints current btc value
|
# Todo
|
||||||
* [x] .finger - does a FINGER ctcp
|
|
||||||
* [x] .gay - colors text in rainbow colors
|
|
||||||
* [x] .hack - prints "hacking..."
|
|
||||||
* [x] .help - lists all available commands
|
|
||||||
* [x] .jn - returns yes or no for a given question
|
|
||||||
* [x] .kiss - kisses a user
|
|
||||||
* [x] .mcmaniac - shows McManiaC memes or adds a new one
|
|
||||||
* [x] .ping - pings a user and prints time
|
|
||||||
* [x] .q - print a quote of a user or adds one
|
|
||||||
* [x] .rainbow - same as .gay
|
|
||||||
* [x] .storyofpomfface - ....
|
|
||||||
* [x] .tell - stores a message for a user and sends it to him when he writes a message in any channel (shows activity)
|
|
||||||
* [x] .time - does a ctcp TIME on a user and prints the returned time
|
|
||||||
* [x] .timer - sets a timer for a specified amount of time and a name
|
|
||||||
* [x] .uptime - prints bot uptime
|
|
||||||
* [x] .ver - does a ctcp VERSION on a user and prints the returned version information
|
|
||||||
* [x] Bier Trigger – nxy schenkt ein kühles blondes an $nick aus
|
|
||||||
* [ ] REEEEEE Trigger – REEEEEEEEEEEEEEEEEEEEEEEEEEEE
|
|
||||||
* [x] Fucken Trigger – nxy fuckt $nick und tötet $nick anschließend.
|
|
||||||
* [ ] joke Trigger – Erzählt einen schlechten Witz
|
* [ ] joke Trigger – Erzählt einen schlechten Witz
|
||||||
* [x] rape trigger
|
|
||||||
* [x] .choose - picks a random entry from a list seperated with commas
|
|
||||||
* [x] .kernel - displays current linux kernel info
|
|
||||||
* [x] .sudoku/.anhero - kicks the user that executes that command
|
|
||||||
* [x] .yt - search for a video on youtube
|
|
||||||
* [x] youtube url parser - returns video information if a youtube link is posted
|
|
||||||
* [ ] .seen trigger – returns the last message and date the user was seen in the channel
|
* [ ] .seen trigger – returns the last message and date the user was seen in the channel
|
||||||
* [ ] .urban - queries urban dictionary
|
* [ ] .urban - queries urban dictionary
|
||||||
|
|
||||||
|
# Done
|
||||||
|
* [x] .help - lists all available commands (builtin)
|
||||||
|
* [x] .uptime - prints bot uptime (builtin)
|
||||||
|
|
||||||
|
## plugins/admin
|
||||||
|
* [x] .reload - reloads a plugin or the whole bot
|
||||||
|
|
||||||
|
## plugins/coins
|
||||||
|
* [x] .btc - prints current btc values
|
||||||
|
* [x] .eth - prints current eth values
|
||||||
|
|
||||||
|
## plugins/ctcp
|
||||||
|
* [x] .finger - does a FINGER ctcp
|
||||||
|
* [x] .ping - does a PING ctcp
|
||||||
|
* [x] .time - does a TIME ctcp
|
||||||
|
* [x] .ver - does a VERSION ctcp
|
||||||
|
|
||||||
|
## plugins/database
|
||||||
|
|
||||||
|
## plugins/linux
|
||||||
|
* [x] useless gnu/linux event
|
||||||
|
* [x] .kernel - displays current linux kernel info
|
||||||
|
|
||||||
|
## plugins/mcmaniac
|
||||||
|
* [x] regex event for Mc(.*)iaC which adds a McManiaC
|
||||||
|
* [x] .mcmaniac - shows a McManiaC (random or by index)
|
||||||
|
|
||||||
|
## plugins/quotes
|
||||||
|
* [x] .q - prints, adds or removes a quote
|
||||||
|
|
||||||
|
## plugins/rape
|
||||||
|
* [x] .owe command
|
||||||
|
* [x] .rape command
|
||||||
|
|
||||||
|
## plugins/seen
|
||||||
|
|
||||||
|
## plugins/tell
|
||||||
|
* [x] .tell - stores a message for a user and sends it to him when he writes a message in any channel (shows activity)
|
||||||
|
|
||||||
|
## plugins/timer
|
||||||
|
* [x] .timer - sets a timer for a specified amount of time and a name
|
||||||
|
|
||||||
|
## plugins/useless
|
||||||
|
* [x] .gay - colors text in rainbow colors
|
||||||
|
* [x] .hack - prints "hacking..."
|
||||||
|
* [x] .jn - returns yes or no for a given question
|
||||||
|
* [x] .kiss - kisses a user
|
||||||
|
* [x] .rainbow - same as .gay
|
||||||
|
* [x] .storyofpomfface - ....
|
||||||
|
* [x] Bier Trigger – nxy schenkt ein kühles blondes an $nick aus
|
||||||
|
* [x] REEEEEE Trigger – REEEEEEEEEEEEEEEEEEEEEEEEEEEE
|
||||||
|
* [x] Fucken Trigger – nxy fuckt $nick und tötet $nick anschließend.
|
||||||
|
* [x] .choose - picks a random entry from a list seperated with commas
|
||||||
|
* [x] .sudoku/.anhero - kicks the user that executes that command
|
||||||
|
|
||||||
|
## plugins/weather
|
||||||
|
* [x] .weather - prints the weather for a given location
|
||||||
|
|
||||||
|
## plugins/youtube
|
||||||
|
* [x] .yt - search for a video on youtube
|
||||||
|
* [x] youtube url parser - returns video information if a youtube link is posted
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"includes": [
|
"includes": [
|
||||||
"irc3.plugins.uptime",
|
"irc3.plugins.uptime",
|
||||||
"nxy.plugins.admin",
|
"nxy.plugins.admin",
|
||||||
"nxy.plugins.bitcoin",
|
"nxy.plugins.coins",
|
||||||
"nxy.plugins.ctcp",
|
"nxy.plugins.ctcp",
|
||||||
"nxy.plugins.linux",
|
"nxy.plugins.linux",
|
||||||
"nxy.plugins.mcmaniac",
|
"nxy.plugins.mcmaniac",
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import irc3
|
|
||||||
import requests
|
|
||||||
|
|
||||||
from docopt import Dict as DocOptDict
|
|
||||||
from irc3.plugins.command import command
|
|
||||||
from irc3.utils import IrcString
|
|
||||||
|
|
||||||
from . import Plugin
|
|
||||||
|
|
||||||
|
|
||||||
@irc3.plugin
|
|
||||||
class Bitcoin(Plugin):
|
|
||||||
requires = ['irc3.plugins.command']
|
|
||||||
|
|
||||||
@command
|
|
||||||
def btc(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
|
||||||
"""Gets the Bitcoin values from BitStamp
|
|
||||||
|
|
||||||
%%btc
|
|
||||||
"""
|
|
||||||
data = requests.get('https://www.bitstamp.net/api/ticker').json()
|
|
||||||
values = {k: float(data[k]) for k in ['last', 'high', 'low', 'volume']}
|
|
||||||
return '\x02[BitStamp]\x0F ' \
|
|
||||||
'Current: \x02\x037${last:,.2f}\x0F - ' \
|
|
||||||
'High: \x02\x033${high:,.2f}\x0F - ' \
|
|
||||||
'Low: \x02\x035${low:,.2f}\x0F - ' \
|
|
||||||
'Volume: \x02฿{volume:,.2f}'.format(**values)
|
|
48
nxy/plugins/coins.py
Normal file
48
nxy/plugins/coins.py
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import irc3
|
||||||
|
import requests
|
||||||
|
|
||||||
|
from docopt import Dict as DocOptDict
|
||||||
|
from irc3.plugins.command import command
|
||||||
|
from irc3.utils import IrcString
|
||||||
|
|
||||||
|
from . import Plugin
|
||||||
|
|
||||||
|
|
||||||
|
@irc3.plugin
|
||||||
|
class Coins(Plugin):
|
||||||
|
requires = ['irc3.plugins.command']
|
||||||
|
|
||||||
|
@command
|
||||||
|
def btc(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
||||||
|
"""Gets the Bitcoin values from BitStamp.
|
||||||
|
|
||||||
|
%%btc
|
||||||
|
"""
|
||||||
|
data = requests.get('https://www.bitstamp.net/api/ticker').json()
|
||||||
|
values = {k: float(data[k]) for k in ['last', 'high', 'low', 'volume']}
|
||||||
|
return '\x02[BitStamp]\x02 ' \
|
||||||
|
'Current: \x02\x037${last:,.2f}\x0F - ' \
|
||||||
|
'High: \x02\x033${high:,.2f}\x0F - ' \
|
||||||
|
'Low: \x02\x035${low:,.2f}\x0F - ' \
|
||||||
|
'Volume: \x02฿{volume:,.2f}\x02'.format(**values)
|
||||||
|
|
||||||
|
@command
|
||||||
|
def eth(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
||||||
|
"""Gets the Ethereum values from etherscan.io.
|
||||||
|
|
||||||
|
%%eth
|
||||||
|
"""
|
||||||
|
volume = self._etherscan('ethsupply')
|
||||||
|
data = self._etherscan('ethprice')
|
||||||
|
return '\x02[EtherScan]\x02' \
|
||||||
|
'\x02\x0307 ${usd:,.2f}\x0F |\x02\x0307 {btc:,.5f} BTC\x0F ' \
|
||||||
|
'- Volume: \x02{volume:,.2f}\x02' \
|
||||||
|
.format(usd=float(data['ethusd']),
|
||||||
|
btc=float(data['ethbtc']),
|
||||||
|
volume=float(int(volume) / 1000000000000000000))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _etherscan(action: str):
|
||||||
|
return requests.get('https://api.etherscan.io/api?module=stats&action='
|
||||||
|
'{action}'.format(action=action)).json()['result']
|
Loading…
Reference in New Issue
Block a user