Skip to content

Instantly share code, notes, and snippets.

View yhay81's full-sized avatar

Yusuke Hayashi yhay81

View GitHub Profile
@yhay81
yhay81 / index.ts
Created March 11, 2020 14:49
mattari admin
import Discord from "discord.js";
const client = new Discord.Client();
// ready
/* Emitted when the client becomes ready to start working. */
client.on("ready", function() {
console.log(`the client becomes ready to start`);
console.log(`I am ready! Logged in as ${client.user.tag}!`);
console.log(

Keybase proof

I hereby claim:

  • I am yhay81 on github.
  • I am yhay81 (https://keybase.io/yhay81) on keybase.
  • I have a public key ASATeAOR3Koo3zBKhXc1r4nRa8NcWkwjS_jWN95oUVPKkgo

To claim this, I am signing this object:

import sqlite3
import random
import discord
client = discord.Client()
conn = sqlite3.connect("recruit.db")
@client.event
async def on_ready():
@yhay81
yhay81 / monster.json
Created February 6, 2019 13:27
MMOくんのモンスターデータ
monsters.json
[
{
"name": "【超強敵!!】デュラハン",
"hp_co": 0,
"dmg_co": 1.0,
"quote": "...",
"img": "dullahan.png"
},
@yhay81
yhay81 / memo.py
Last active January 3, 2023 08:49
メモを記憶させたり、出したりできるdiscordのbotです
import sqlite3
import discord
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
@yhay81
yhay81 / file0.txt
Last active December 6, 2018 14:19
Google Apps Script 用 Slack API ライブラリ作った ref: https://qiita.com/yhay81/items/edf74af8efe3d3d1a1b5
var token = 'xoxb-34...みたいなトークン';
var slack = GASlacker.methods(token);
function doPost(e){
var event = JSON.parse(e.postData.contents).event;
if(event.text.match(/hello/)){
var text = "Hello," + event.message.username;
slack.chat.postMessage(event.channel, text);
}
}
class NaturalNumber:
def __init__(self, p=None):
self.predecessor = p
def __eq__(self, x):
if self.predecessor is None and x.predecessor is None:
return True
elif (self.predecessor is None and x.predecessor is not None) \
or (self.predecessor is not None and x.predecessor is None):
return False
@yhay81
yhay81 / CorgiBot.js
Last active March 24, 2018 11:22
Slack bot who react some words and return a giphy.
var SLACK_ACCESS_TOKEN = PropertiesService.getScriptProperties().getProperty('SLACK_ACCESS_TOKEN');
var GIPHY_API_KEY = PropertiesService.getScriptProperties().getProperty('GIPHY_API_KEY');
// var SPREAD_SHEET_ID = PropertiesService.getScriptProperties().getProperty('SPREAD_SHEAT_ID');
var POST_MESSAGE_ENDPOINT = 'https://slack.com/api/chat.postMessage';
var TEXTS = [
'Do you like dogs?:dog:',
'You said the word!:grinning:',
'I hope you like this...:poodle:',
'Dogs are cute!:dog2: Dogs are cute!:dog2:',
@yhay81
yhay81 / utils.py
Created March 20, 2018 21:22
Python speed test
from functools import wraps
from time import time
def timing(f):
@wraps(f)
def wrapper(*args, **kwds):
s = time()
f(*args, **kwds)
return time() - s
let count = 0;
const doOnlyOnce = function (){
if(count==0){
console.log("You do this for first time.");
}else{
console.log("You already have done this.");
}
count++;
};