-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
492 lines (413 loc) · 23.8 KB
/
app.py
File metadata and controls
492 lines (413 loc) · 23.8 KB
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
import discord
from discord.ext import commands
import random
import re
import os
from key import key
from jokes import jokes
from convostarters import convostarters
import pickle
import praw
import time
import typing
import asyncio
from PIL import Image, ImageDraw, ImageFilter
import requests
from currency import leaderboard, deposit, buy, balance, buy, daily, give, inventory, steal, shop, withdraw
from moderator import warn, pardon, pardonall, mute, setslowmode, purge
from io import BytesIO
from common import tryLoadSavedDict, client, embedColour, embedFooters, completedReaction, badArgsError, badBotPermsError, badMemberPermsError, nonExistentCommandError
from counting import setcountingchannel, on_message
from music import play, stop
class MemberData:
def __init__(self, warns, xp, level, rank, levelUpThreshold):
self.warns = warns
self.xp = xp
self.level = level
self.rank = rank
self.levelUpThreshold = levelUpThreshold
class SetupData:
def __init__(self, lvlUpChannel, lvlUpMsg, welcomeChannel, welcomeMsg):
self.lvlUpChannel = lvlUpChannel
self.lvlUpMsg = lvlUpMsg
self.welcomeChannel = welcomeChannel
self.welcomeMsg = welcomeMsg
reddit = praw.Reddit(client_id='9B_9EgNR0RblQQ', client_secret='de1ze7ZZ9q7GajWI5ZYkXv451vQ', user_agent='ZBot_v1')
memberDataFilename = "memberData.pickle"
setupDataFilename = "setupData.pickle"
defaultLevelUpThreshold = 20
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name='for z help'))
global memberUnpickledData
global setupUnpickledData
memberUnpickledData = tryLoadSavedDict(memberDataFilename)
setupUnpickledData = tryLoadSavedDict(setupDataFilename)
@client.command()
async def help(message, helpType:typing.Optional[str]):
if helpType == None:
embedVar = discord.Embed(title="ZBot Help Commands", description="", color=embedColour)
embedVar.add_field(name="Setup", value="`z help setup`")
# embedVar.add_field(name="Levels", value="`z help lvls`")
embedVar.add_field(name="Currency", value="`z help currency`")
embedVar.add_field(name="Moderator", value="`z help mod`")
embedVar.add_field(name="Counting", value="`z help counting`")
embedVar.add_field(name="Music (⚙ still under construction)", value="`z help music`")
embedVar.add_field(name="Other", value="`z help misc`")
elif helpType == "setup":
embedVar = discord.Embed(title="ZBot Setup Commands", description="", color=embedColour)
# embedVar.add_field(name="`z setlvlupchannel [Channel]`", value="Sets a specific channel for the level up message", inline=False)
# embedVar.add_field(name="`z setlvlupmsg [Message]`", value='Syntax example: z setlvlupmsg Nice job [mention]! You are now level [level]!"', inline=False)
embedVar.add_field(name="`z setwelcomechannel [Channel]`", value="Sets a specific channel for the welcome message", inline=False)
embedVar.add_field(name="`z setwelcomemsg [Message]`", value='Syntax example: z setwelcomemsg Welcome to the server [mention]!', inline=False)
embedVar.add_field(name="`z configuration`", value='(AKA config) Shows you the your server setup configuration', inline=False)
elif helpType == "mod":
embedVar = discord.Embed(title="ZBot Moderator Commands", description="", color=embedColour)
embedVar.add_field(name="`z setslowmode [Seconds] [Channel](Optional)`", value="(Moderators only) Changes the channel's slowmode", inline=False)
embedVar.add_field(name="`z purge [Number]`", value="(Moderators only) Deletes a number of messages in the channel the command is said in", inline=False)
embedVar.add_field(name="`z warn [Member] [Reason](Optional)`", value="(Moderators only) Warns a member, once they recieve three warns and they're kicked", inline=False)
embedVar.add_field(name="`z warns [Member](Optional)`", value="Shows you the all the info on a member's warns", inline=False)
embedVar.add_field(name="`z pardon [Member]`", value="(Moderators only) Clears a member's warns", inline=False)
embedVar.add_field(name="`z pardonall`", value="(Moderators only) Clears everyone's warns", inline=False)
embedVar.add_field(name="`z mute [Member] [Time](Seconds)(Optional) [Reason](Optional)`", value="(Moderators only) Mutes a member for a number of seconds", inline=False)
elif helpType == "misc":
embedVar = discord.Embed(title="ZBot Miscellaneous Commands", description="", color=embedColour)
embedVar.add_field(name="`z slap [Member]`", value="Slaps someone", inline=False)
embedVar.add_field(name="`z hug [Member]`", value="Hugs someone", inline=False)
embedVar.add_field(name="`z throne [Member]`", value="LONG LIVE THE KING", inline=False)
embedVar.add_field(name="`z wave [Member]`", value="Send someone a wave", inline=False)
embedVar.add_field(name="`z high5 [Member]`", value="High five someone", inline=False)
embedVar.add_field(name="`z meme`", value="Fetches a meme from reddit", inline=False)
embedVar.add_field(name="`z joke`", value="Send you a normal joke", inline=False)
embedVar.add_field(name="`z conversationstarter`", value="(AKA convostart) Sends you a conversation starter", inline=False)
# elif helpType == "lvls":
# embedVar = discord.Embed(title="ZBot Level Commands", description="", color=embedColour)
# embedVar.set_footer(text=random.choice(embedFooters()), icon_url=discord.utils.get(message.guild.members, name="ZBot").avatar_url)
# embedVar.set_thumbnail(url=discord.utils.get(message.guild.members, name="ZBot").avatar_url)
# embedVar.add_field(name="`z level [Username](Optional)`", value="(AKA lvl) Tells you your/someone else's level and xp", inline=False)
# embedVar.add_field(name="`z levels`", value="(AKA lvls) Gives you the rank of all ranked members", inline=False)
# await message.channel.send(embed=embedVar)
elif helpType == "currency":
embedVar = discord.Embed(title="ZBot Currency Commands", description="", color=embedColour)
embedVar.add_field(name="*`z vote`*", value="**No vote link yet... Coming soon** - *Gives you a special reward for voting for the bot*", inline=False)
embedVar.add_field(name="`z work`", value="(1 min cooldown) Earns you some money", inline=False)
embedVar.add_field(name="`z daily`", value="(24 hr cooldown) Gives you your daily reward", inline=False)
embedVar.add_field(name="`z deposit [Amount](Can be 'all' or a number)`", value="(AKA dep) Deposits your money in the bank for safekeeping", inline=False)
embedVar.add_field(name="`z buy [Item] [Amount](Optional)`", value="Buys an item with the name given", inline=False)
embedVar.add_field(name="`z withdraw [Amount](Can be 'all' or a number)`", value="(AKA with) Takes your money out of the bank to use", inline=False)
embedVar.add_field(name="`z steal [Member]`", value="(5 min cooldown)(AKA rob) Steals a member's coins... Or not", inline=False)
embedVar.add_field(name="`z give [Member] [Amount/Item]`", value="Give a member some coins or an item", inline=False)
embedVar.add_field(name="`z balance [Member](Optional)`", value="(AKA bal) Shows you how many coins you have in your wallet *and* your bank", inline=False)
embedVar.add_field(name="`z inventory [Member](Optional)`", value="(AKA inv) Shows you the items that you own", inline=False)
embedVar.add_field(name="`z shop`", value="(AKA store) Shows you the items that you can buy", inline=False)
embedVar.add_field(name="`z leaderboard`", value="(AKA lb) Shows you the global leaderboard", inline=False)
elif helpType == "counting":
embedVar = discord.Embed(title="ZBot Counting Commands", description="", color=embedColour)
embedVar.add_field(name="How To Play", value="You start off at **0**, the first person types **1**. You can't go twice in a row, but if you do, it's not a big deal. If you get the wrong number though, you have to restart back from **0**!", inline=False)
embedVar.add_field(name="`z setcountingchannel`", value='(Moderators only) Sets the channel that you count in', inline=False)
elif helpType == "music":
embedVar = discord.Embed(title="ZBot Music Commands", description="", color=embedColour)
embedVar.add_field(name="`z play [Search/URL](Optional)`", value="**You can't actually play music yet** - (AKA join) Joins the voice channel and plays some music", inline=False)
embedVar.add_field(name="`z stop`", value='(AKA leave, disconnect) Leaves the voice channel', inline=False)
embedVar.set_footer(text=random.choice(embedFooters()), icon_url=discord.utils.get(message.guild.members, name="ZBot").avatar_url)
embedVar.set_thumbnail(url=discord.utils.get(message.guild.members, name="ZBot").avatar_url)
await message.channel.send(embed=embedVar)
#Misc
@client.command()
async def joke(message):
await message.channel.send(random.choice(jokes))
@client.command(aliases=['convostart'])
async def conversationstarter(message):
await message.channel.send(random.choice(convostarters))
@client.command()
async def meme(message):
meme_submissions = reddit.subreddit('memes').hot()
post_to_pick = random.randint(1, 25)
for i in range(0, post_to_pick):
submission = next(x for x in meme_submissions if not x.stickied)
await message.channel.send(submission.url)
@client.command()
async def slap(message, member:discord.Member):
response1 = requests.get(message.author.avatar_url)
response2 = requests.get(member.avatar_url)
img = Image.open("c:/users/zacha/source/repos/zbot/slapBG.jpg")
member1 = Image.open(BytesIO(response1.content))
member1Resized = member1.resize((250, 250))
member2 = Image.open(BytesIO(response2.content))
member2Resized = member2.resize((250, 250))
mainImg = img.copy()
mainImg.paste(member1Resized, (500, 100))
mainImg.paste(member2Resized, (850, 350))
mainImgBytes = BytesIO()
mainImg.save(mainImgBytes, "jpeg")
mainImg.save("c:/users/zacha/source/repos/zbot/slap.jpg", quality=25)
await message.channel.send(file=discord.File("c:/users/zacha/source/repos/zbot/slap.jpg"))
@client.command()
async def hug(message, member:discord.Member):
response1 = requests.get(message.author.avatar_url)
response2 = requests.get(member.avatar_url)
img = Image.open("c:/users/zacha/source/repos/zbot/hugBG.jpg")
member1 = Image.open(BytesIO(response1.content))
member1Resized = member1.resize((250, 250))
member2 = Image.open(BytesIO(response2.content))
member2Resized = member2.resize((250, 250))
mainImg = img.copy()
mainImg.paste(member2Resized, (310, 200))
mainImg.paste(member1Resized, (620, 150))
mainImgBytes = BytesIO()
mainImg.save(mainImgBytes, "jpeg")
mainImg.save("c:/users/zacha/source/repos/zbot/hug.jpg", quality=25)
await message.channel.send(file=discord.File("c:/users/zacha/source/repos/zbot/hug.jpg"))
@client.command()
async def throne(message, member:discord.Member):
response = requests.get(member.avatar_url)
img = Image.open("c:/users/zacha/source/repos/zbot/throneBG.jpg")
member = Image.open(BytesIO(response.content))
memberResized = member.resize((100, 100))
mainImg = img.copy()
mainImg.paste(memberResized, (185, 110))
mainImgBytes = BytesIO()
mainImg.save(mainImgBytes, "jpeg")
mainImg.save("c:/users/zacha/source/repos/zbot/throne.jpg", quality=25)
await message.channel.send(file=discord.File("c:/users/zacha/source/repos/zbot/throne.jpg"))
@client.command()
async def wave(message, member:discord.Member):
response1 = requests.get(message.author.avatar_url)
response2 = requests.get(member.avatar_url)
img = Image.open("c:/users/zacha/source/repos/zbot/waveBG.jpg")
member1 = Image.open(BytesIO(response1.content))
member1Resized = member1.resize((150, 150))
member2 = Image.open(BytesIO(response2.content))
member2Resized = member2.resize((100, 100))
mainImg = img.copy()
mainImg.paste(member1Resized, (120, 45))
mainImg.paste(member2Resized, (540, 140))
mainImgBytes = BytesIO()
mainImg.save(mainImgBytes, "jpeg")
mainImg.save("c:/users/zacha/source/repos/zbot/wave.jpg", quality=25)
await message.channel.send(file=discord.File("c:/users/zacha/source/repos/zbot/wave.jpg"))
@client.command()
async def high5(message, member:discord.Member):
response1 = requests.get(message.author.avatar_url)
response2 = requests.get(member.avatar_url)
imgPath = "{rootPath}\highfiveBG.png".format(rootPath=os.path.dirname(os.path.abspath(__file__)))
img = Image.open(imgPath)
member1 = Image.open(BytesIO(response1.content))
member1Resized = member1.resize((200, 200))
member2 = Image.open(BytesIO(response2.content))
member2Resized = member2.resize((200, 200))
mainImg = img.copy()
mainImg.paste(member1Resized, (500, 400))
mainImg.paste(member2Resized, (1450, 475))
mainImgBytes = BytesIO()
mainImg.save(mainImgBytes, "png")
mainImg.save(imgPath, quality=25)
await message.channel.send(file=discord.File(imgPath))
#Setup
@client.command()
@commands.has_permissions(kick_members=True)
async def setlvlupchannel(message):
setLevelUpChannel(message.guild, message.channel)
await message.message.add_reaction(completedReaction)
@client.command()
@commands.has_permissions(kick_members=True)
async def setlvlupmsg(message):
msg = message.message.content.replace(message.message.content[:14], "", 1)
setLevelUpMessage(message.guild, msg)
await message.message.add_reaction(completedReaction)
@client.command()
@commands.has_permissions(kick_members=True)
async def setwelcomechannel(message, channel:typing.Optional[discord.TextChannel]):
setWelcomeChannel(message.guild, message.channel)
await message.message.add_reaction(completedReaction)
@client.command()
@commands.has_permissions(kick_members=True)
async def setwelcomemsg(message):
msg = message.message.content.replace(message.message.content[:16], "", 1)
setWelcomeMessage(message.guild, msg)
await message.message.add_reaction(completedReaction)
@client.command(aliases=['config'])
async def configuration(message):
data = loadSetupData(message.guild)
welcomeChannel = client.get_channel(data.welcomeChannel)
lvlUpChannel = client.get_channel(data.lvlUpChannel)
# if lvlUpChannel == None:
# lvlUpChannelName = 'None'
# else:
# lvlUpChannelName = lvlUpChannel.name
if welcomeChannel == None:
welcomeChannelName = 'None'
else:
welcomeChannelName = welcomeChannel.name
# if data.lvlUpMsg == '':
# lvlUpMsg = 'None'
# else:
# lvlUpMsg = data.lvlUpMsg
if data.welcomeMsg == '':
welcomeMsg = 'None'
else:
welcomeMsg = data.welcomeMsg
embedVar = discord.Embed(title="{serverName} Configuration".format(serverName=message.guild.name), description="", color=embedColour)
embedVar.set_footer(text=random.choice(embedFooters()), icon_url=discord.utils.get(message.guild.members, name="ZBot").avatar_url)
embedVar.set_thumbnail(url=message.guild.icon_url)
embedVar.add_field(name="Welcome message", value=welcomeMsg, inline=False)
embedVar.add_field(name="Welcome channel", value=welcomeChannelName, inline=False)
# embedVar.add_field(name="Level up message", value=lvlUpMsg, inline=False)
# embedVar.add_field(name="Level up channel", value=lvlUpChannelName, inline=False)
await message.channel.send(embed=embedVar)
#Lvls
@client.command(aliases=['lvl'])
async def level(message, member:typing.Optional[discord.Member]):
if member == None:
member = message.author
memberInfo = await getMemberInfo(message, member)
embedVar = discord.Embed(title="", description="", color=embedColour)
embedVar.set_footer(text=random.choice(embedFooters()), icon_url=discord.utils.get(message.guild.members, name="ZBot").avatar_url)
embedVar.set_thumbnail(url=member.avatar_url)
embedVar.add_field(name="XP", value="{xp}/{max}".format(xp=str(memberInfo.xp), max=str(memberInfo.levelUpThreshold)), inline=False)
embedVar.add_field(name="Level", value=str(memberInfo.level), inline=False)
embedVar.add_field(name="Rank", value="#{rank}".format(rank=str(memberInfo.rank)), inline=False)
await message.channel.send(embed=embedVar)
@client.command(aliases=['lvls'])
async def levels(message):
members = loadMemberData(message.guild)
sortedMembers = sorted(members.items(), key = lambda kv: kv[1].rank)
embedVar = discord.Embed(title="Levels Leaderboard", description="", color=embedColour)
embedVar.set_footer(text=random.choice(embedFooters()), icon_url=discord.utils.get(message.guild.members, name="ZBot").avatar_url)
embedVar.set_thumbnail(url=discord.utils.get(message.guild.icon_url))
for memberName, data in sortedMembers:
embedVar.add_field(name="#{rank} - {memberName}".format(rank=str(data.rank), memberName=memberName), value="level {level}".format(level=str(data.level)), inline=False)
embedVar.set_thumbnail(url=discord.utils.get(message.guild.members, name="ZBot").avatar_url)
await message.channel.send(embed=embedVar)
#Events
@client.event
async def on_member_join(member):
setupData = loadSetupData(member.guild)
welcomeMsg = setupData.welcomeMsg.replace('[mention]', member.mention)
channel = client.get_channel(setupData.welcomeChannel)
if channel == None or welcomeMsg == "":
return
await channel.send(welcomeMsg)
@client.event
async def on_command_error(message, error):
if isinstance(error, commands.MissingPermissions):
await message.channel.send(badMemberPermsError)
elif isinstance(error, commands.MissingRequiredArgument):
await message.channel.send(badArgsError)
elif isinstance(error, commands.CommandOnCooldown):
if error.cooldown.per > 3600:
cooldown = "**{cooldown}** hour".format(cooldown=str(int(error.cooldown.per/3600)))
elif error.cooldown.per > 60:
cooldown = "**{cooldown}** minute".format(cooldown=str(int(error.cooldown.per/60)))
else:
cooldown = "**{cooldown}** second".format(cooldown=str(int(error.cooldown.per)))
if error.retry_after > 3600:
retryAfter = "**{cooldown}** hours".format(cooldown=str(int(error.retry_after/3600)))
elif int(error.retry_after) > 60:
retryAfter = "**{cooldown}** minutes".format(cooldown=str(int(error.retry_after/60)))
else:
retryAfter = "**{cooldown}** seconds".format(cooldown=str(int(error.retry_after)))
await message.channel.send("Woah slow down there man, that command has a {cooldown} cooldown. Try again in {retryAfter}".format(cooldown=str(cooldown), retryAfter=str(retryAfter)))
elif isinstance(error, commands.BotMissingPermissions):
await message.channel.send(badBotPermsError)
elif isinstance(error, commands.CommandNotFound):
await message.channel.send(nonExistentCommandError)
#Functions
async def assignRole(role, user):
await user.add_roles(role, reason=None, atomic=False)
async def removeRole(role, user):
await user.remove_roles(role, reason=None, atomic=False)
#Member functions
def loadMemberData(guild):
if str(guild) in memberUnpickledData:
return memberUnpickledData[str(guild)]
else:
memberUnpickledData[str(guild)] = dict()
return memberUnpickledData[str(guild)]
def saveMemberData():
with open(memberDataFilename, "wb") as file:
pickle.dump(memberUnpickledData, file)
#Levels
async def giveMemberXP(xpAmount, message):
if message.author.bot:
return
members = loadMemberData(message.guild)
if not str(message.author) in members:
members[str(message.author)] = MemberData(0, 0, 0, 0, defaultLevelUpThreshold)
members[str(message.author)].xp += xpAmount
# member.levelUpThreshold = defaultLevelUpThreshold
if members[str(message.author)].xp >= members[str(message.author)].levelUpThreshold:
members[str(message.author)].level += 1
members[str(message.author)].xp = 0
members[str(message.author)].levelUpThreshold += 10
setupData = loadSetupData(message.guild)
msg = setupData.lvlUpMsg
lvlUpMsg = None
if msg != None:
lvlUpMsg = msg.replace('[mention]', "**{mention}**".format(mention=message.author.mention))
# memberInfo = await getMemberInfo(message, message.author)
# lvlUpMsg = lvlUpMsg.replace('[level]', str(memberInfo.level))
lvlUpMsg = lvlUpMsg.replace('[level]', str(members[str(message.author)].level))
channel = client.get_channel(setupData.lvlUpChannel)
if channel == None:
channel = message.channel
if lvlUpMsg == "":
lvlUpMsg = ("**{mention}** you leveled up! You are now level {level}".format(mention=message.author.mention, level=str(members[str(message.author)].level)))
await channel.send(lvlUpMsg)
setMemberRanks(message, message.guild)
saveMemberData()
async def getMemberInfo(message, member):
members = loadMemberData(message.guild)
if not str(member) in members:
members[str(member)] = MemberData(0, 0, 0, 0, defaultLevelUpThreshold)
if message.guild.get_member_named(str(member)) == None:
await message.channel.send("That's not a member bro")
return None
setMemberRanks(message, message.guild)
return members[str(member)]
def setMemberRanks(message, guild):
members = loadMemberData(message.guild)
for member in members:
members[str(member)].rank = len(members)
for checkMember in members:
if members[str(member)].level > members[str(checkMember)].level:
members[str(member)].rank -= 1
elif members[str(member)].level == members[str(checkMember)].level:
if members[str(member)].xp > members[str(checkMember)].xp:
members[str(member)].rank -= 1
elif members[str(member)].xp == members[str(checkMember)].xp:
members[str(member)].rank = members[str(checkMember)].rank
saveMemberData()
def clearLevels(message, member):
members = loadMemberData(message.guild)
members[str(member)].rank = 0
members[str(member)].xp = 0
members[str(member)].level = 0
members[str(member)].levelUpThreshold = defaultLevelUpThreshold
saveMemberData()
#Setup data functions
def saveSetupData():
with open(setupDataFilename, "wb") as file:
pickle.dump(setupUnpickledData, file)
def loadSetupData(guild):
if not str(guild) in setupUnpickledData:
setupUnpickledData[str(guild)] = SetupData(None, "", None, "")
return setupUnpickledData[str(guild)]
def setLevelUpChannel(guild, channel):
setupData = loadSetupData(guild)
setupData.lvlUpChannel = channel.id
saveSetupData()
def setLevelUpMessage(guild, msg):
setupData = loadSetupData(guild)
setupData.lvlUpMsg = msg
saveSetupData()
def setWelcomeChannel(guild, channel):
setupData = loadSetupData(guild)
setupData.welcomeChannel = channel.id
saveSetupData()
def setWelcomeMessage(guild, msg):
setupData = loadSetupData(guild)
setupData.welcomeMsg = msg
saveSetupData()
client.run(key)