Skip to content

Instantly share code, notes, and snippets.

@3-24
Created March 28, 2020 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3-24/11ee58bb101325c104025edf9879724c to your computer and use it in GitHub Desktop.
Save 3-24/11ee58bb101325c104025edf9879724c to your computer and use it in GitHub Desktop.
디스코드 랜덤봇
#!/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