Created
March 28, 2020 04:58
-
-
Save 3-24/11ee58bb101325c104025edf9879724c to your computer and use it in GitHub Desktop.
디스코드 랜덤봇
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import discord | |
import random | |
import os | |
TOKEN = os.environ["randombot_TOKEN"] | |
client = discord.Client() | |
@client.event | |
async def on_ready(): | |
print('We have logged in as {0.user}'.format(client)) | |
@client.event | |
async def on_message(message): | |
if message.author.bot: | |
return | |
if message.content.startswith('!랜덤'): | |
L = message.content.split()[1:] | |
if L == []: | |
await message.channel.send('하와와.. 저의 선택은.. *그딴거 없다.*') | |
else: | |
await message.channel.send("하와와.. 저의 선택은 {}인 것이와요..".format(random.choice(L))) | |
return | |
client.run(TOKEN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment