Add ramen handler
parent
5f8f89988b
commit
542976eb9d
10
itte.py
10
itte.py
|
@ -1,5 +1,6 @@
|
|||
import socket
|
||||
import yaml
|
||||
from random import randint
|
||||
from sys import exit
|
||||
from time import sleep
|
||||
|
||||
|
@ -14,6 +15,9 @@ class Util:
|
|||
fh.close()
|
||||
return data
|
||||
|
||||
def rand(self, lst):
|
||||
"""Return a random item from a given list."""
|
||||
return lst[randint(0, len(lst)-1)]
|
||||
|
||||
class IRC:
|
||||
"""Methods for basic IRC communication."""
|
||||
|
@ -52,7 +56,7 @@ class IRC:
|
|||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.sock.connect(server)
|
||||
except ConnectionError as err:
|
||||
exit("[debug] " + str(err))
|
||||
exit("[debug] " + str(err))
|
||||
self.send("USER", bot_nick + " " + bot_nick + " " + \
|
||||
bot_nick + " " + bot_nick)
|
||||
self.send("NICK", bot_nick)
|
||||
|
@ -64,7 +68,7 @@ class IRC:
|
|||
# Currently only one server per app instance is supported, so
|
||||
# disconnect also exits the app
|
||||
exit("Shutting down ...")
|
||||
|
||||
|
||||
def keepalive(self, line):
|
||||
"""Stay connected to a server by responding to server pings."""
|
||||
if "PING" in line:
|
||||
|
@ -77,7 +81,7 @@ class IRC:
|
|||
self.send("JOIN", c)
|
||||
|
||||
def send(self, command, text, *args, **kwargs):
|
||||
"""Send messages given the IRC command and text. Optionally specify a
|
||||
"""Send messages given the IRC command and text. Optionally specify a
|
||||
message recipient with `recvr=user`."""
|
||||
recvr = kwargs.get("recvr", "")
|
||||
if recvr != "":
|
||||
|
|
80
ramenkan.py
80
ramenkan.py
|
@ -1,4 +1,3 @@
|
|||
import yaml
|
||||
from random import randint
|
||||
|
||||
from itte import IRC, Util
|
||||
|
@ -11,7 +10,9 @@ class Ramen:
|
|||
"""Instantiate an IRC object and attach the listeners."""
|
||||
# Load yaml sources used by request handlers
|
||||
self.util = Util()
|
||||
self.rand = self.util.rand
|
||||
self.links = self.util.yml("ramenkan/links.yml")
|
||||
self.dishes = self.util.yml("ramenkan/dishes.yml")
|
||||
# Init irc object
|
||||
self.irc = IRC()
|
||||
self.cfg = self.irc.config("ramenkan/config.sample.yml")
|
||||
|
@ -25,6 +26,8 @@ class Ramen:
|
|||
self.irc.listen(cxt, "help", self.rollcall)
|
||||
self.irc.listen(cxt, "water " + self.cfg["bot_nick"], self.water)
|
||||
self.irc.listen(cxt, "botsnack " + self.cfg["bot_nick"], self.botsnack)
|
||||
self.irc.listen(cxt, "ramen", self.ramen)
|
||||
self.irc.listen(cxt, "rk", self.ramen)
|
||||
self.irc.listen(cxt, "rklink", self.link)
|
||||
|
||||
def quit(self, cxt):
|
||||
|
@ -36,7 +39,7 @@ class Ramen:
|
|||
"一、二、三、らーめん缶! "
|
||||
"Hello, I am a ramen vending machine. "
|
||||
"Please type a code for service: "
|
||||
"!help !rklink - "
|
||||
"!help !ramen !rklink - "
|
||||
"Support: +81 012-700-1MIO どうぞめしあがれ。"
|
||||
)
|
||||
self.irc.reply(cxt, resp)
|
||||
|
@ -45,18 +48,77 @@ class Ramen:
|
|||
resp = [
|
||||
("\x01ACTION happily pours the hot liquid into a bowl of noodles "
|
||||
"and offers it to ") + cxt["msg"]["nick"] + "\x01",
|
||||
"( ^_^)o自自o(^_^ )Cheers!",
|
||||
"Water Level [/////////] 200% - Thanks! (^▽^)"
|
||||
"Cheers! 自o(^_^ )",
|
||||
"Water Level [/////////] 200% - Thanks! (^▽^ )",
|
||||
("Thanks. Some people say I have a CRABby tempeRAMENt. "
|
||||
"I wonder why. (´-` )"),
|
||||
("Q. What do you call noodles made from the core of a tree? "
|
||||
"A. DuRAMEN. *ba dum tss* ┐('∀`;)┌"),
|
||||
("Q. What do you call noodles eaten on bulletin boards? "
|
||||
"A. FoRAMEN. *ba dum tss* ┐('∀`;)┌"),
|
||||
("Q. What kind of noodles can be found at TV stations? "
|
||||
"A. CameRAMEN. *ba dum tss* ┐('∀`;)┌")
|
||||
]
|
||||
self.irc.reply(cxt, resp[randint(0, len(resp)-1)])
|
||||
self.irc.reply(cxt, self.rand(resp))
|
||||
|
||||
def botsnack(self, cxt):
|
||||
self.irc.reply(cxt, "Ramen time anytime! 自o(´▽`)/")
|
||||
resp = [
|
||||
"CHIKIN RAAAAAMEN━━━(゜∀゜)━━━!!!!!",
|
||||
"Ramen time anytime! 自o(´▽` )/"
|
||||
]
|
||||
self.irc.reply(cxt, self.rand(resp))
|
||||
|
||||
def make_ramen_combo(self):
|
||||
dish = self.dishes
|
||||
combo = "ramen in "
|
||||
# Noodle type and broth richness
|
||||
if randint(0, 1):
|
||||
combo = self.rand(dish["noodle-shape"]) + ", " + \
|
||||
self.rand(dish["noodle-broth-type"]) + " "
|
||||
combo = combo.capitalize()
|
||||
# Broth type
|
||||
combo += self.rand(dish["broth"] + dish["broth-veggie"]) + " broth"
|
||||
# Topping
|
||||
n_top = randint(2, 4)
|
||||
for n in range(2, n_top+1):
|
||||
if n == 2:
|
||||
prev_top = self.rand(dish["topping"] + dish["meat"])
|
||||
combo += " with " + prev_top
|
||||
else:
|
||||
if n > 2 and n < n_top:
|
||||
combo += ", "
|
||||
else:
|
||||
combo += " and "
|
||||
next_top = self.rand(dish["topping"] + dish["meat"])
|
||||
# Check for duplicate
|
||||
if next_top == prev_top:
|
||||
next_top = self.rand(dish["topping"])
|
||||
combo += next_top
|
||||
prev_top = next_top
|
||||
# Condiment and side dish
|
||||
if randint(0, 1):
|
||||
combo += ", garnished with " + self.rand(dish["condiment"]) + "."
|
||||
else:
|
||||
combo += "."
|
||||
if randint(0, 1):
|
||||
combo += " Served with " + self.rand(dish["tapa"] + \
|
||||
dish["tapa-veggie"]) + "."
|
||||
return combo
|
||||
|
||||
def ramen(self, cxt):
|
||||
roll = randint(1, 100)
|
||||
# 1% possibility of regional preset
|
||||
if roll == 100:
|
||||
resp = (self.rand(self.dishes["set"] + \
|
||||
self.dishes["set-veggie"]) + ".").capitalize()
|
||||
else:
|
||||
resp = self.make_ramen_combo()
|
||||
self.irc.reply(cxt, resp)
|
||||
|
||||
def link(self, cxt):
|
||||
rand = randint(0, len(self.links)-1)
|
||||
self.irc.reply(cxt, self.links[rand]["title"] + " " + \
|
||||
self.links[rand]["link"])
|
||||
index = randint(0, len(self.links)-1)
|
||||
self.irc.reply(cxt, self.links[index]["title"] + " " + \
|
||||
self.links[index]["link"])
|
||||
|
||||
|
||||
app = Ramen()
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
broth:
|
||||
- Kobe beef bone
|
||||
- pork bone
|
||||
- chicken and pork bone
|
||||
- niboshi and pork bone # dried little sardines
|
||||
- seafood, chicken and pork bone
|
||||
- chicken, pork bone, tuna and kelp
|
||||
- pork bone and soy sauce
|
||||
- fish
|
||||
- gyokai
|
||||
- roasted tuna
|
||||
|
||||
broth-veggie:
|
||||
- miso
|
||||
- spicy miso
|
||||
- soy sauce
|
||||
- grilled soy sauce and Rishiri kelp
|
||||
- salt
|
||||
- salt and soy sauce
|
||||
|
||||
noodle-broth-type:
|
||||
- thick noodles in rich
|
||||
- medium-thick noodles in mild
|
||||
- thin noodles in light
|
||||
|
||||
noodle-shape:
|
||||
- curly
|
||||
- flat
|
||||
- straight
|
||||
|
||||
condiment:
|
||||
- butter
|
||||
- chili oil
|
||||
- rayu # Japanese chili oil
|
||||
- chili pepper
|
||||
- chili sauce
|
||||
- sesame oil
|
||||
- Japanese curry
|
||||
- dashi # fish and seaweed stock
|
||||
- white pepper
|
||||
- black pepper
|
||||
- ponzu # citrus sauce
|
||||
- shichimi # spice blend
|
||||
|
||||
topping:
|
||||
- bean sprouts
|
||||
- chili flakes
|
||||
- sweet corn
|
||||
- grated garlic
|
||||
- roasted garlic chips
|
||||
- beni shoga # pickled ginger
|
||||
- bamboo shoots
|
||||
- menma # fermented bamboo shoots
|
||||
- dried mushrooms
|
||||
- shiitake mushrooms
|
||||
- kikurage # wood ear
|
||||
- karashi takana # spicy pickled mustard greens
|
||||
- negi # Welsh onion
|
||||
- white onions
|
||||
- spring onions
|
||||
- sichuan peppers
|
||||
- nori
|
||||
- wakame
|
||||
- sauerkraut
|
||||
- sesame seeds
|
||||
- scallions
|
||||
- boiled spinach
|
||||
|
||||
meat:
|
||||
- a seasoned boiled egg
|
||||
- raw eggs
|
||||
- Kobe beef fillet
|
||||
- Kobe beef sirloin
|
||||
- wagyu
|
||||
- teppanyaki beef
|
||||
- beef shank
|
||||
- chicken breast
|
||||
- teppanyaki chicken
|
||||
- crab
|
||||
- crispy duck
|
||||
- filet mignon
|
||||
- kamaboko # fish paste/surimi
|
||||
- narutomaki # fish paste with swirling pattern
|
||||
- kakuni # cubed braised pork
|
||||
- barbecued pork # chashu
|
||||
- pork confit
|
||||
- pork cutlet
|
||||
- pork belly
|
||||
- pork shoulder
|
||||
- shrimp
|
||||
- sea urchin
|
||||
- scallops
|
||||
- squid
|
||||
|
||||
tapa:
|
||||
- gyoza # dumplings (fried)
|
||||
- karaage # fried chicken
|
||||
- tako wasabi # marinated octopus
|
||||
- takoyaki # octopus balls
|
||||
- corn and shrimp salad
|
||||
- crab salad
|
||||
- enoki rolls
|
||||
|
||||
tapa-veggie:
|
||||
- edamame tossed in sea salt # boiled/steamed soyabeans
|
||||
- tofu nuggets
|
||||
- pickled daikon
|
||||
- cucumber salad
|
||||
- seaweed salad # wakame, sesame seeds, mirin
|
||||
|
||||
set:
|
||||
- Korean kimchi ramyeon with tteok
|
||||
- Vancouver beer ramen (cold bonito broth ramen with egg whites)
|
||||
- Hakata tonkotsu ramen with pickled mustard greens
|
||||
- Hakodate shio ramen with kelp, crab, shrimp, sea urchin and scallops
|
||||
- Hakodate shrimp ramen with a hard-boiled egg and white onions
|
||||
- Kagoshima tonkotsu ramen with chashu, dried sardines, kelp and scallions
|
||||
- Kitakata niboshi-tonkotsu ramen with chashu, naruto and spring onions
|
||||
- Kumamoto tonkotsu ramen with chashu, raw eggs, scallions and garlic chips
|
||||
- Muroran curry ramen with chashu, wakame and bean sprouts
|
||||
- Osaka Kobe beef sirloin ramen with a soft-boiled egg and arugula
|
||||
- Sapporo miso ramen with scallops, sweet corn and bean sprouts
|
||||
- Tokyo ramen in chicken broth with pork, menma, a boiled egg and nori
|
||||
- Wakayama shoyu-tonkotsu ramen with pork slices, naruto and scallions
|
||||
- Yokohama ramen with chashu, spinach, a soft-boiled egg and negi
|
||||
|
||||
set-veggie:
|
||||
- miso ramen with vegetable broth, cabbage and bean sprouts
|
||||
- ramen with shiitake mushrooms, kombu and sesame oil
|
||||
- ramen with soyabean pork slices, kikurage, bamboo shoots and scallions
|
||||
- barley miso ramen with roasted vegetables
|
|
@ -1,9 +1,18 @@
|
|||
- title: Ramen, Soul Food Staple
|
||||
link: https://www3.nhk.or.jp/nhkworld/en/food/articles/51.html
|
||||
- title: Shin-Yokohama Ramen Museum, Yokohama
|
||||
link: http://www.raumen.co.jp/english/
|
||||
- title: Ramen Street, Tokyo
|
||||
link: https://en.wikipedia.org/wiki/Ramen_street
|
||||
- title: Sapporo Ramen Republic
|
||||
link: http://www.sapporo-esta.jp/ramen
|
||||
- title: Ramen DB, a directory of ramen shops in Japan
|
||||
link: https://ramendb.supleks.jp/
|
||||
- title: Ramen Adventures, a ramen shop review blog
|
||||
link: http://www.ramenadventures.com/
|
||||
# Recipes
|
||||
- title: 15 Fantastic Ramen Recipes
|
||||
link: https://www3.nhk.or.jp/nhkworld/en/food/articles/131.html
|
||||
# Instant noodles
|
||||
- title: Momofuku Ando, inventor of instant ramen (1958)
|
||||
link: https://www.nissin.com/en_jp/about/founder/
|
||||
|
@ -13,7 +22,11 @@
|
|||
link: https://instantnoodles.org/en/activities/support.html
|
||||
- title: Samyang, the first Korean instant ramen (1963)
|
||||
link: https://en.wikipedia.org/wiki/Samyang_ramen
|
||||
- title: The Ramen Rater, an instant ramen blog
|
||||
link: https://www.theramenrater.com/
|
||||
# Ramen in pop culture
|
||||
- title: Ramen Manga, comic strips in Japanese about ramen
|
||||
link: https://www.ramenbank.com/manga/
|
||||
- title: Flower Boy Ramen Shop, romantic comedy drama (2011)
|
||||
link: https://en.wikipedia.org/wiki/Flower_Boy_Ramen_Shop
|
||||
- title: The Ramen Girl, romantic comedy film (2008)
|
||||
|
@ -26,3 +39,30 @@
|
|||
link: https://www.detectiveconanworld.com/wiki/Ramen_So_Good,_It%27s_to_Die_For
|
||||
- title: Ramen Teh, film (2018)
|
||||
link: https://en.wikipedia.org/wiki/Ramen_Teh
|
||||
- title: Ramen yori taisetsuna mono, documentary (2013)
|
||||
link: https://www.imdb.com/title/tt2945642/
|
||||
# Videos
|
||||
- title: What Owning a Ramen Restaurant in Japan is Like
|
||||
link: https://www.youtube.com/watch?v=gmIwxqdwgrI
|
||||
- title: Begin Japanology - Ramen
|
||||
title: https://www.youtube.com/watch?v=RosUc9UVuos
|
||||
- title: Japanology Plus - Ramen
|
||||
link: https://www.youtube.com/watch?v=K2Jzt04QY7A
|
||||
- title: In Search of the Perfect Bowl of Ramen
|
||||
link: https://www.youtube.com/watch?v=bhiFtP9qVYc
|
||||
- title: Rahaku TV (The Shin-Yokohama Ramen Museum Youtube Channel)
|
||||
link: http://www.youtube.com/rahakutv
|
||||
- title: The History of Ramen Yamagoya
|
||||
link: https://www.youtube.com/watch?v=8NBwKbT5QSQ
|
||||
- title: Ramen Daruma
|
||||
link: https://www.youtube.com/watch?v=zkhDYTR789w
|
||||
- title: The God of Ramen, trailer (2013)
|
||||
link: https://www.youtube.com/watch?v=mtwunTGnnR4
|
||||
- title: Ramen Heads, trailer (2017)
|
||||
link: https://www.youtube.com/watch?v=u61b5R_S4TM
|
||||
- title: Ramenomania - Noodles, Asia's Second Obsession
|
||||
link: https://www.youtube.com/watch?v=tfW89yAoTNs
|
||||
- title: Noodle Me
|
||||
link: https://www.youtube.com/watch?v=r9jLJRZ6gnc
|
||||
- title: Visio Documentary - Fat Ramen
|
||||
link: https://www.youtube.com/watch?v=o78fy4rJFCw
|
||||
|
|
Loading…
Reference in New Issue