Skip to content

Instantly share code, notes, and snippets.

@Waipy252
Waipy252 / hukidashi.css
Created September 10, 2023 11:36
吹き出し用CSS
.talk10 {
margin-bottom: 10px;
}
.talk10 figure img {
width: 100%;
height: 100%;
border: 2px solid #9ce191; /* 円の線の太さと色の設定 */
border-radius: 50%;
margin: 0;
@Waipy252
Waipy252 / api.js
Last active September 10, 2023 12:29
ChatGPTを使ったDiscordボット
const OpenAI = require('openai')
const API_KEY = 'YOUR_OPENAPI_TOKEN'
const openai = new OpenAI({
apiKey: API_KEY
});
const getChatResponse = async (text) => {
const chatCompletion = await openai.chat.completions.create({
model: "gpt-3.5-turbo",
const OpenAI = require('openai')
const API_KEY = 'YOUR_OPENAPI_TOKEN'
const openai = new OpenAI({
apiKey: API_KEY
});
const getChatResponse = async (text) => {
const chatCompletion = await openai.chat.completions.create({
model: "gpt-3.5-turbo",
@Waipy252
Waipy252 / lambda_function.py
Created September 19, 2023 09:47
ページカウンターのlambda関数
import json
import boto3
import time
from botocore.exceptions import ClientError
# DynamoDBテーブル名
table_name = 'PageViews'
# DynamoDBクライアントのセットアップ
dynamodb = boto3.client('dynamodb')
<script>
//ここのurlをlambda関数URLに書き換える
let lambdaUrl = 'https://yourlambdaurlcomeshere.lambda-url.ap-northeast-1.on.aws/'
//ページの表示回数を数える
fetch(lambdaUrl, {
method: 'POST',
headers: {
'Content-Type': 'text/plain',
},