-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
74 lines (59 loc) · 2.19 KB
/
index.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import selfcord
import asyncio
import os
import sys
from selfcord.ext import commands
CHANNAL_ID = 728579098854817792
bot = commands.Bot(command_prefix=';;', self_bot=True)
@bot.event
async def on_ready():
print('Logged in hopefully ok!')
channel = bot.get_channel(CHANNAL_ID)
await channel.send('Am i ready?')
@bot.command()
async def ping(ctx):
print('radom')
dir = os.getcwd()
async def PrintToUser(message, user):
try:
f = open(dir + '/Users/' + user + '.txt', 'x')
f.close()
except:
x = 1
file = open(dir + '/Users/' + user + '.txt','a')
file.write(message)
file.close()
async def PrintToServer(message, serverid):
stringserverid = str(serverid)
try:
f = open(dir + '/Servers/' + stringserverid + '.txt', 'x')
f.close()
except:
x = 1
file = open(dir + '/Servers/' + stringserverid + '.txt','a')
file.write(message)
file.close()
@bot.event
async def on_message(message):
if(message.content != ''):
try:
AuthorName = message.author.name
AuthorChannelName = message.channel.name
AuthorChannelid = message.channel.id
AuthorServerName = message.guild.name
AuthorServerid = message.guild.id
AuthorContent = message.content
isBot = message.author.bot
except:
print(f'[ERRORRAS BUVO]')
fulltext = f'[{AuthorName}]([{AuthorServerName}][{AuthorChannelName}]) {AuthorContent}'
IntoPersonText = f'([{AuthorServerName}][{AuthorChannelName}]) {AuthorContent}\n'
IntoServerText = f'[{AuthorName}]([{AuthorChannelName}]) {AuthorContent}\n'
if(AuthorName != 'sofdrg' and isBot == False):
await PrintToUser(IntoPersonText, AuthorName)
await PrintToServer(IntoServerText, AuthorServerid)
print(fulltext)
sys.stdout.flush()
channel = bot.get_channel(CHANNAL_ID)
await channel.send(f'([{AuthorServerName}][{AuthorChannelName}])\n[{AuthorName}] {AuthorContent}')
bot.run('MTIwOTU1ODYzNDA5OTM4NDM4MA.GcgNnM.lIrYbv4yffK-w0i-ahmnxhMOllDImuw5JqwaVo')