-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
52 lines (39 loc) · 1.36 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import markovify
import nltk
import re #regex
import random
import discord
import asyncio
import ctypes
ctypes.windll.kernel32.SetConsoleTitleW("NAME")
with open("SCRAPED MESSAGE DATA GOES HERE.txt") as f:
text = f.read()
text_model = markovify.Text(text, state_size=2)
class POSifiedText(markovify.Text):
def word_split(self, sentence):
words = re.split(self.word_split_pattern, sentence)
words = [ "::".join(tag) for tag in nltk.pos_tag(words) ]
return words
def word_join(self, words):
sentence = " ".join(word.split("::")[0] for word in words)
return sentence
client = discord.Client()
async def bot():
await client.wait_until_ready()
counter = 0
channel = discord.Object(id='CHANNEL ID GOES HERE')
while not client.is_closed:
UN = '**' + random.choice(open('NAMES LIST GOES HERE.txt').readlines()) + '**'
temp = text_model.make_sentence()
if temp is not None: temp2 = UN + temp
#await channel.webhooks()
if temp is not None: await client.send_message(channel, temp2)
await asyncio.sleep(random.randint(1, 30))
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
client.loop.create_task(bot())
client.run('TOKEN')