Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Discord Bot はじめの一歩
ASKUL Engineer
March 30, 2021
Technology
0
250
Discord Bot はじめの一歩
20210325 AStudy+
https://askul.connpass.com/event/204742/
speaker:みわすけ
ASKUL Engineer
March 30, 2021
Tweet
Share
More Decks by ASKUL Engineer
See All by ASKUL Engineer
EditorConfigで導くコードの「美しさ」
askul
0
350
いまさら聞けないAWS
askul
0
1.6k
CTOが語る、テックカンパニーに向けた未来の話。by アスクル
askul
0
56
チームでリーダブルコードを実現するには?
askul
0
1.6k
ラズパイを使ってスマートリモコンを作ってみた
askul
0
350
10分で「エラスティックリーダーシップ」をアウトプット
askul
0
740
1on1をする上で大切なこと
askul
1
330
JBUG東京#20 〜そこが知りたい!Backlog活用術〜
askul
1
1.7k
GCPを活用した物流倉庫内の異常検知/Anomaly detection in distribution warehouse using GCP
askul
0
2.7k
Other Decks in Technology
See All in Technology
やってみたLT会 Fleet Managerのススメ
yukiiiiikuma
PRO
0
410
Continuous Architecture Design for Modernization
humank
3
500
第22回 MLOps 勉強会:みてねのMLOps事情
tonouchi510
1
1k
脆弱性スキャナのOWASP ZAPを コードベースで扱ってみる / OWASP ZAP on a code base
task4233
1
250
Amazon Comprehendで始める感情分析
46ta
0
200
ここが好きだよAWS管理ポリシー_devio2022/i_am_iam_lover
yukihirochiba
0
3.2k
ECS Exec を使った ECS の トラブルシューティング
dohara
0
150
聊聊 Cgo 的二三事
david74chou
0
330
SPAとWebアプリケーションでCognitoの使い方はどう変わるのか? / How do we use cognito with SPA and web applications?
kitano_yuichi
0
410
質の良い”カイゼン”の為の質の良い「振り返り」
shirayanagiryuji
0
130
MySQL v5.7 勉強会/study-mysql-ver-5-7
andpad
0
2.1k
GCCP Creator @ COSCUP 2022
line_developers_tw
PRO
0
1.4k
Featured
See All Featured
Designing for Performance
lara
597
64k
The Illustrated Children's Guide to Kubernetes
chrisshort
18
40k
The Language of Interfaces
destraynor
148
21k
Infographics Made Easy
chrislema
233
17k
A Tale of Four Properties
chriscoyier
149
21k
Building a Scalable Design System with Sketch
lauravandoore
448
30k
Three Pipe Problems
jasonvnalue
89
8.7k
How GitHub Uses GitHub to Build GitHub
holman
465
280k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
316
19k
Web development in the modern age
philhawksworth
197
9.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
212
20k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
6
570
Transcript
DiscordBot はじめの⼀歩 アスクル株式会社 三輪亮介
⾃⼰紹介 • ⾃分について⾊々わかっていないためサイズ違いの靴や服が 余っている • 社会⼈になって太った • 業務では、AWSの構築などインフラ関連のことを⾏なっている 1
⽬次 1. Discordの紹介 2. やってみる 3. Botの例 2
Discordって︖ • ビデオ、⾳声通話ソフト • 1つのサーバーに複数の通話部屋、チャット部屋を作ることが できる 3
4
DiscordのBotって︖ • ユーザーの⼊⼒に⾃動応答させられる • ユーザーができることはだいたいできる • 複数⾔語対応 (https://discordpy.readthedocs.io/ja/latest/api.html) 5
6 やってみる
サンプル import discord import os import setToken # 環境変数を使うべき。今回は外部ファイルを参照 #
token = os.environ['DISCORD_TOKEN’] TOKEN = setToken.tokenclient = discord.Client()# 起動時 @client.event async def on_ready(): print("AStudy discordBot")# チャットイベント @client.event async def on_message(message): # メッセージ送信者がBotだった場合は無視する if message.author.bot: return # /test に対してhelloを返答 if message.content == '/test': await message.channel.send('hello')# bot起動 client.run(TOKEN) 7