Skip to content

Instantly share code, notes, and snippets.

@abiriadev
Last active June 25, 2021 19:16
Show Gist options
  • Save abiriadev/6863bbdd86bfe825d20d16bf0561671d to your computer and use it in GitHub Desktop.
Save abiriadev/6863bbdd86bfe825d20d16bf0561671d to your computer and use it in GitHub Desktop.
scorebot.py
import discord, asyncio, os
from dotenv import load_dotenv
load_dotenv()
score = {}
client = discord.Client(intents=discord.Intents.all())
@client.event
async def on_ready():
print("I'm Ready!")
@client.event
async def on_message(msg):
print(msg.content)
if msg.author.bot:
return
id = msg.author.id
if id in score and type(score[id]) == int:
score[id] += 1
else:
score[id] = 1
if score[id] >= 10:
await msg.channel.send(f"와! {score[id]}개의 채팅을 치셨어요! 축하드려요!")
if msg.content == "!score":
await msg.channel.send(str(score))
@client.event
async def on_member_join(member):
print("dsssssssssss")
await member.send(f"안녕하세요! `{member.guild.name}`서버에 오신 걸 환영해요!")
client.run(os.environ["TOKEN"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment