Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.68 KB | None | 0 0
  1. import random
  2. import discord
  3. from discord.ext import commands
  4. import time
  5. import asyncio
  6.  
  7. # id = 559392094351917076
  8. messages = 0
  9. joined = 0
  10. bot = commands.Bot(command_prefix="-")
  11.  
  12. client = discord.Client()
  13.  
  14.  
  15. def read_token():
  16.     with open("token.txt", "r") as f:
  17.         lines = f.readlines()
  18.         return lines[0].strip()
  19.  
  20.  
  21. token = read_token()
  22.  
  23.  
  24. async def update_stats():
  25.     await client.wait_until_ready()
  26.     global messages, joined
  27.  
  28.     while not client.is_closed():
  29.         try:
  30.             with open("statts.txt", "a") as f:
  31.                 f.write(f"Time: {int(time.time())}, Messages: {messages}, Members Joined: {joined}\n")
  32.  
  33.                 messages = 0
  34.                 joined = 0
  35.  
  36.                 await asyncio.sleep(5)
  37.         except Exception as e:
  38.             print(e)
  39.             await asyncio.sleep(5)
  40.  
  41. channel_id = 0
  42.  
  43.  
  44. @client.event
  45. async def on_member_join(member):
  46.     channel = member.guild.get_channel(channel_id)
  47.     await channel.send(random.choice(["a", "b", "c"]))
  48.  
  49.  
  50. @client.event
  51. async def on_message(message):
  52.     global messages
  53.     messages += 1
  54.  
  55.     # id = client.get_guild(559392094351917076)
  56.     channel = ["general"]
  57.     kufurler = ["supermice", "SUPERMICE", "SUPERMİCE"]
  58.  
  59.     for word in kufurler:
  60.         if message.content.count(word) > 0:
  61.             print("someone swore")
  62.             await message.delete()
  63.  
  64.     if str(message.channel) in channel:
  65.         if message.content == "-link":
  66.             await message.channel.send("github link")
  67.         elif message.content == "-help":
  68.             await message.channel.send(f"""help message""")
  69.         elif message.content == "bot seni seviyorum":
  70.             await message.channel.send(f"""ben seni sevmiyom orospu çocuğu ben utkuyu seviom""")
  71.         elif message.content.find("spotify") != -1:
  72.             await message.channel.send(f"""https://cdn.discordapp.com/attachments/559392094796382208/595274093654310912/unknown.png""")
  73.         elif message.content == "-author":
  74.             await message.channel.send(f"""angel lau#3173""")
  75.         elif message.content.startswith("-truth"):
  76.             reply = random.choice(
  77.                 ["şüphesiz", "sanane", "Tabii ki hayır!!", "tekrar sor bu sefer söylicem", "üşeniom",
  78.                  "ANLAMADIM TKR SOR?", "SİKTİR GİT.", "EVET", "AŞIK OLDUM",
  79.                  "AGA BU SORUYA CEVAP VERMEMİ BEKLEME"])
  80.             await message.channel.send(f"{message.author.mention} {reply}")
  81.         elif message.content.startswith("-random "):
  82.             args = message.content.split(" ")[1:]
  83.             await message.channel.send(random.choice(args))
  84.  
  85.  
  86. client.loop.create_task(update_stats())
  87. client.run(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement