@HUDSON_REYREY/

GreenBandle

Python

No description

fork
loading
Files
  • main.py
  • D:\userwarnings.txt
  • keep_alive.py
  • requirements.txt
  • Unecessary.txt
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
import discord
from keep_alive import keep_alive
import os
import asyncio
import requests
import random
from random import randint
from flask import Flask
from threading import Thread

app = Flask('discord bot')
client = discord.Client()

MMM = None
botonverify = None
usermess = None
bot_status = discord.Status.dnd


@client.event
async def on_ready():
    global botonverify
    global usermess
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print(
        'https://discordapp.com/oauth2/authorize?client_id={}&scope=bot&permissions=8'
        .format(538303980053200897))
    print('------')
    streaminn = discord.Streaming(
        name="at war, refilling ammo.", url=None)

    await client.change_presence(
        activity=discord.Activity(name='at war, refilling ammo.', type=3),
        status=discord.Status.do_not_disturb,
        afk=False)
    animT = await discord.abc.Messageable.fetch_message(
        client.get_channel(537966940488990732), 542282624882835456)
    #animT = client.wait_for('message', check=542282624882835456)
    while True:
        await asyncio.sleep(2)
        await animT.edit(content="""```
        ___
  ____(____\───    }  
  \___________\ 
   \O__O__O__O/  ```""")
        await asyncio.sleep(2)
        await animT.edit(content="""```
        ___
  ____(____\───         >>
  \___________\ 
   \O__O__O__O/  ```""")
        await asyncio.sleep(2)
        await animT.edit(content="""```
        ___
  ____(____\─«( 
  \___________\ 
   \O__O__O__O/  ```""")
        await asyncio.sleep(2)
        await animT.edit(content="""```
        ___
  ____(____\\── <<{ 
  \___________\ 
   \O__O__O__O/  ```""")


laughs = ['lol', 'lmao', 'lel', 'hah', 'xd', 'lmfao']
verify = [
    'shell', 'tank', 'rocket', 'nuke', 'soldier', 'artillery', 'flack',
    'trench', 'bombs', 'rifles', 'guns', 'commander', 'captain', 'lieutenant'
]
toyou = [
    'Ping me and I will gas you! ', 'I will kick you if you ping me again! ',
    'Do not attempt to ping or mention my name. ', 'You want a kick? '
]
rolled = [
    'has tossed the dice and got', 'threw the dice and got',
    'shook the dice very well and got', 'angrily throws the dice and receives',
    'throws the deadly dice and got', 'rolls the dice off the table and got'
]
welcoming = [
    'Welcome to the battlefield,', 'Hello,', 'Heck yeah! You are here',
    "Greetings soldier", "Hey ", "Nice uniform, ", "Nice guns you have",
    "We revived you. Get back up your feet,"
]
welcomT = [
    "It's good to see you bringing ammunation. QUICKLY RELOAD!",
    "You brought an army with you. NICE!",
    "NO WAY!!! Nice artillery you got there!", "We are winning this war!",
    "We are losing this war! Start helping!",
    "You got good guns? I don't have any!", "Just start digging!",
    "Watch out! Bomber coming! DUCK!", "Freaking DUCK! There's a bomber!",
    "There's a tank! Stay low!!!",
    "The tank is coming! Quickly get your dynamite and stick it on the tank!",
    "You made me impressed with your combat skills.",
    "Nice skills! I wish I was like you!",
    "God dangit! Let's finish this already!", "Bring out the boom!",
    "We are prepared!"
]


@client.event
async def on_member_join(member):
    welcChan = client.get_channel('537966367530418179')
    await discord.abc.Messageable.send(content=(
        welcChan, "**{} {}! {}**".format(
            random.choice(welcoming), member.mention, random.choice(welcomT))))


@client.event
async def on_message(message):
    msg = message.content.lower()
    if message.content.startswith('!go2gulag'):
        await discord.abc.Messageable.trigger_typing(message.channel)
        await asyncio.sleep(2)
        await discord.abc.Messageable.send(message.channel, content=(
            '**Stalin has sent me to Gulag. BYE!**' + '\U0001F44B'))
        await client.close()
        await client.logout()

    #Change user's nickname!
    elif msg.split()[0] == "!gnick":
        if '544498833204314143' in [rr.id for rr in message.author.roles]:
            print(msg)
            print(message.mentions(0))
            await client.change_nickname(message.mentions[0],
                                         message.content.split(" ", 2)[2])

    #Warn users!
    elif msg.split()[0] == '!gwarn':
        if '544498833204314143' in [rr.id for rr in message.author.roles]:
            lineno = len(open('D:\\userwarnings.txt').read().splitlines())
            print('there are {} lines'.format(lineno))
            print('warned ' + message.mentions[0].name)
            db = open('D:\\userwarnings.txt', 'r+')
            content = [line.strip() for line in db]
            listof = ''
            for l in content:
                listof += l + '\n'
            if str(message.mentions[0].id) in listof:
                print("Data has been found!")
                for l in content:
                    if message.mentions[0].id in l:
                        print(str(l))  # Prints ur required line
                        print('Line number {0}'.format(
                            content.index(l) + 1))  # Prints the line number
                        addwarn = None
                        print(str(l).split()[0] + " < User ID")
                        print(str(l).split()[1] + " Warnings")
                        E = open('D:\\userwarnings.txt', "r+")
                        g = open('D:\\userwarnings.txt', "r")
                        if str(l).split()[1] == "0":
                            addwarn = 1
                            print('A user getting a 2nd warning!')
                            await client.send_message(
                                message.channel, message.mentions[0].mention +
                                " has 1/3 warnings (*Reset*)")
                        elif str(l).split()[1] == "1":
                            addwarn = 2
                            print('A user getting a 2nd warning!')
                            await client.send_message(
                                message.channel, message.mentions[0].mention +
                                " has 2/3 warnings. **You have violated the rules.**"
                            )
                        elif str(l).split()[1] == "2":
                            addwarn = 3
                            print('A user getting a 3rd warning!')
                            await client.send_message(
                                message.channel, message.mentions[0].mention +
                                " has 3/3 warnings. ***One more move!!!***")
                        elif str(l).split()[1] == "3":
                            addwarn = 0
                            print(message.mentions[0].name +
                                  ' will get a role soon')
                            await client.send_message(
                                message.channel, message.mentions[0].mention +
                                " is punished! ***You did a good job getting a punishment!***"
                            )
                            await asyncio.sleep(2)
                            badrole = discord.utils.get(
                                message.server.roles, id='539748277860433920')
                            verirole = discord.utils.get(
                                message.server.roles, name="VERIFIED")
                            await client.add_roles(message.mentions[0],
                                                   badrole)
                            await client.remove_roles(message.mentions[0],
                                                      verirole)
                        text = g.read()
                        x = text.replace(
                            str(l), "{} {}".format(message.mentions[0].id,
                                                   str(addwarn)))
                        E.write(str(x))
                        print('--------------Warned---------------')
                        print(' ')
                        g.close()
                        db.close()
                        E.close()
            elif not str(message.mentions[0].id) in listof:
                print("IT AIN'T FOUND!")
                db.write('{} 1 \n'.format(message.mentions[0].id))
                print('{} has 1st warning'.format(message.mentions[0].name))
                await client.send_message(
                    message.channel, "{} is given a first warning.".format(
                        message.mentions[0].name))
                db.close()
        elif not '544498833204314143' in [
                rr.id for rr in message.author.roles
        ]:
            await client.send_message(
                message.channel, message.author.mention +
                "! ***You do not have the permission to warn a user!***")

    #         Soft delete
    elif message.content.startswith('!clear'):
        async for msgs in client.logs_from(message.channel):
            if not msgs.pinned:
                await client.delete_message(msgs)
            elif msgs.pinned:
                None

    #         Spam delete
    elif message.content.startswith('!purge'):
        if '541970446778761234' in [rr.id for rr in message.author.roles]:
            await client.purge_from(message.channel)
        elif not '541970446778761234' in [
                rr.id for rr in message.author.roles
        ]:
            None

    #         Throwing the dice!
    elif message.content.startswith('!dice'):
        if message.channel.id == '538868453461721118':
            await client.send_message(
                message.channel, message.author.mention + ' {} **{}**'.format(
                    random.choice(rolled), random.randint(1, 6)))

    #        Do verification with the user.
    elif message.channel.id == '539755025858297867':
        if message.content.startswith('^verify'):
            if '539447009527070720' not in [
                    r.id for r in message.author.roles
            ]:
                botV = await client.send_message(
                    message.channel, 'Verify by reacting ' + '\U0001F44B' + ' '
                    + message.author.mention)
                await client.add_reaction(botV, '\U0001F44B')
                dreact = await client.wait_for_reaction(
                    '\U0001F44B', user=message.author, message=botV)
                print('Verifying')
                await asyncio.sleep(1)
                roleee = discord.utils.get(
                    message.server.roles, name='VERIFIED')
                # Role has been got! Now for the verifying
                await client.start_private_message(message.author)
                await client.send_message(
                    message.author,
                    'Copy and paste this at the verify room to get verified! Hurry up!!!'
                )
                returninn = await client.send_message(
                    message.author, '{} {} {} {} {}'.format(
                        random.choice(verify), random.choice(verify),
                        random.choice(verify), random.choice(verify),
                        random.choice(verify)))
                ## Wait for the person to say back! V
                botonverify = returninn
                sayback = await client.wait_for_message(
                    author=message.author,
                    channel=message.channel,
                    content=returninn.content)
                await asyncio.sleep(1)
                usermess = sayback
                await client.delete_message(botV)
                await client.delete_message(message)
                #await client.delete_message(usermess)
                await client.send_message(
                    message.author,
                    'You have been verified at ' + message.channel.server.name)
                await client.add_roles(message.author, roleee)
            elif '539447009527070720' in [r.id for r in message.author.roles]:
                await client.delete_message(message)
        elif not message.content.startswith('^verify'):
            if message.author.id != '538303980053200897':
                await asyncio.sleep(0.3)
                await client.delete_message(message)
    elif msg.startswith("ping"):
        await client.add_reaction(message, '\U0001F3D3')
    elif msg.startswith("hi") or msg.startswith("hello"):
        await client.add_reaction(message, '\U0001F44B')
    elif msg.startswith('ok'):
        await client.add_reaction(message, '\U0001F44C')
    elif (message.mentions):
        for mem in message.mentions:
            if mem.id == '538303980053200897':
                await client.send_typing(message.channel)
                await asyncio.sleep(2)
                await client.send_message(
                    message.channel, "{} ".format(random.choice(toyou)) +
                    message.author.mention + '!')


keep_alive()
token = os.environ.get("DISCORD_BOT_SECRET")
client.run('NTM4MzAzOTgwMDUzMjAwODk3.XW42Aw.BtsmT0km0sMl-q58q9LJPgeVUTw')