From e4152b1f89f8346000135d0de05b2c588d6da0f6 Mon Sep 17 00:00:00 2001 From: ProMinato500 Date: Wed, 18 Aug 2021 22:43:21 +0530 Subject: [PATCH 1/2] fixed meet partially --- .../__pycache__/helpcmd.cpython-39.pyc | Bin 975 -> 977 bytes src/commands/__pycache__/meet2.cpython-39.pyc | Bin 0 -> 2007 bytes .../__pycache__/meetcmd.cpython-39.pyc | Bin 709 -> 711 bytes .../__pycache__/member.cpython-39.pyc | Bin 821 -> 823 bytes src/commands/__pycache__/tasks.cpython-39.pyc | Bin 1466 -> 1468 bytes src/commands/meet2.py | 75 ++++++++++++++++++ src/dbmongo/__pycache__/db.cpython-39.pyc | Bin 446 -> 448 bytes src/main.py | 7 +- .../__pycache__/remainder.cpython-39.pyc | Bin 1174 -> 1192 bytes src/remainder/remainder.py | 7 +- .../__pycache__/postReminder.cpython-39.pyc | Bin 958 -> 960 bytes .../postmeetReminder.cpython-39.pyc | Bin 804 -> 806 bytes .../__pycache__/preReminder.cpython-39.pyc | Bin 1235 -> 1237 bytes .../premeetReminder.cpython-39.pyc | Bin 777 -> 779 bytes src/utils/postmeetReminder.py | 1 - src/utils/premeetReminder.py | 1 - 16 files changed, 79 insertions(+), 12 deletions(-) create mode 100644 src/commands/__pycache__/meet2.cpython-39.pyc create mode 100644 src/commands/meet2.py diff --git a/src/commands/__pycache__/helpcmd.cpython-39.pyc b/src/commands/__pycache__/helpcmd.cpython-39.pyc index 6231ee4905a0719a6a0aead5a214cfb6075cd7ae..6d09a47a510e886c36664fb9104edbdea70d356a 100644 GIT binary patch delta 58 zcmX@levzF!k(ZZ?0SH=|WH)k4Fe^GFTg8MHrxq2*1Qg}_X67Z9k(ZZ?0SGd*q&IR)Fw5H|Tg8MHrxq2*1Qg}_X67Z9s14u^&6MN zw?O+17Z)EB78@|cCm^UnNn)fVAOv+YF#{83E3r~5u%>%YZ! zM8-y8DwCQWqp)DMsPPzeo7#mV&5;FmS2@&a8523x+?Ih_Imk1s@T5I*#s*ef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ython-39.pyc b/src/commands/__pycache__/meetcmd.cpython-39.pyc index 3073bdd88372303d241c0f5080c575693cf57cd6..ca7ffb798e431ce4b8ea5bf56ca8b864c09078a6 100644 GIT binary patch delta 146 zcmX@gdYqLzk(ZZ?0SH=|WH)k8Wekqu$xY16i_c9hE>28OjbbiN&WK`3EJ`=L#gdzv zT2jOYRC|jhvm`ZlB}0)Akn_tS*(xTqIJKxaCZH(aH#0A>BtOO_wK%&ZzaS>Pv@A1e g@<&ERMuEw~Ov*sgoGDaP0H_VD7l{y_ypTx+0DsRZ3jhEB delta 144 zcmX@kdX$wrk(ZZ?0SGd*q&IR;WemKfVo|!`EtcHW z)RH1LpxRq3nI);YD;bJJft+7<$yPC;#i>QbF#$#SzL|N6CHXNfsm0kP`2{iQrDc;p eGb%C)PZniT29lOcp`yY-O<tft5Toqm?lh3nMGg?jdX0;Nv0*V)bB#{Wq$+K7$00s#eMgRZ+ delta 92 zcmdnPy^EVWk(ZZ?0SGd*q&ISVv4}(o78Ioxr{dWeDWMt1ps+97kB^w diff --git a/src/commands/meet2.py b/src/commands/meet2.py new file mode 100644 index 0000000..0f3f1ca --- /dev/null +++ b/src/commands/meet2.py @@ -0,0 +1,75 @@ +from dbmongo import db +import asyncio +from datetime import datetime +import pymongo +import discord +global times_used + +dbs = db.connection() + +client = discord.Client() + +#&schedule Discord Bot @Pradipta Nandi 1d 2h 3m + +async def scheduleMeet(message): + keywords = ['m', 'h', 'd'] + command = message.content.split() + title = command[1] + keyword = command[-3:] + duration = 0 + dbs = db.connection() + seconds = { + "m": duration * 60, + "h": duration * 60 * 60, + "d": duration * 24 * 60 * 60 + } + + present_timestamp = datetime.now().timestamp() + deadline_duration = present_timestamp + for eachTime in keyword: + print(eachTime) + duration = int(eachTime[:-1]) + print(duration) + k = eachTime[-1] + deadline_duration = deadline_duration + seconds[k] + print(deadline_duration) + + schedule_date = datetime.fromtimestamp(deadline_duration) + countmeet = dbs.Count_Meet.find() + for item in countmeet: + counter = item["count"] + dbs.Data.insert_one({"ids": str(counter), "Topic": title, + "DateTime": schedule_date, "TimeStamp": deadline_duration, "Reminder": 2}) + print("Scheduled successfully!") + await message.channel.send(f"Scheduled successfully! ID: {counter}") + dbs.Count_Meet.update_one({"ids": "4"}, {"$inc": {"count": 1}}) + embed = discord.Embed( + title="Meeting Scheduled💻", + description="Topic: " + + title, + colour=discord.Colour.blue() + ) + name = message.author + embed.set_author(name=str(name)[:-5]) + embed.set_footer(text="Please attend the meeting") + emoji1 = '✅' + emoji2 = '❎' + mentions = command[2:-3] + men = mentions + for user in men: + if str(user) == '@here': + msg = await message.channel.send(embed=embed) + await msg.add_reaction(emoji1) + await msg.add_reaction(emoji2) + for user in message.mentions: + msgs = await user.send(embed=embed) + await msgs.add_reaction(emoji1) + await msgs.add_reaction(emoji2) + ment = list() + for user in men: + ment.append(user[3:-1]) + print(ment) + msgid = message.channel.id + dbs.Data.update_one({"ids": str(counter)}, {"$set": {"members": ment}}) + dbs.Data.update_one({"ids": str(counter)}, { + "$set": {"MessageChannel": msgid}}) diff --git a/src/dbmongo/__pycache__/db.cpython-39.pyc b/src/dbmongo/__pycache__/db.cpython-39.pyc index 63ca89fd66ff03a81e93e3fc84dce0f009bb5b9a..e6257a499d6fe685b30f158f3c438eda1230bad0 100644 GIT binary patch delta 33 ncmdnTe1Mrdk(ZZ?0SH=|WH)jvGBR3C)@77q%1oN<%~%WoZvqC; delta 30 kcmX@WypNeXk(ZZ?0SGd*q&IRaGBR3B)@78N?8{gT09@_{3;+NC diff --git a/src/main.py b/src/main.py index fc24f4c..9acdcee 100644 --- a/src/main.py +++ b/src/main.py @@ -1,6 +1,6 @@ import discord import datetime -from commands import meet +from commands import meet2 from commands import tasks from commands import helpcmd from commands import meetcmd @@ -89,8 +89,7 @@ async def on_message(message): if message.author.bot: return elif message.content.startswith('&schedule'): - print("meet") - await meet.scheduleMeet(message) + await meet2.scheduleMeet(message) elif message.content.startswith('&Task'): await tasks.Tasks(message) elif message.content.startswith('&meet'): @@ -101,4 +100,4 @@ async def on_message(message): await helpcmd.help(message) -client.run(os.environ['DISCORD_TOKEN']) +client.run('ODQ5OTA3OTQ5MjYxNDIyNjAy.YLiAdQ.mlWpR6TmhNXPtmmNAnHG4BFYlPM') diff --git a/src/remainder/__pycache__/remainder.cpython-39.pyc b/src/remainder/__pycache__/remainder.cpython-39.pyc index 390f9a86afa7eec0b937fd24a63751a5affd78fb..3c2d5df8c44db06e7dda6f4131ecb2897fc304d4 100644 GIT binary patch delta 123 zcmbQnxq_1~k(ZZ?0SG48$|f?fP2`hdjG3tIERn*H!kEJm#gWRofO8>36jusc3VRDf z6!*qD31&v;$$9gmLdW` QDGo*sMjj~SVB%l|07EhtAOHXW delta 103 zcmZ3%IgOJqk(ZZ?0SGd*q!XXBPUMqe44J6yERf2&fMX#;6lV%s3VRDf6xYT!31&ve y$@7`zChup~;N}GCC^i7;W1Ren*@TgMvO0_2eachTask['deadline']: await postReminder.send_after_reminder(Client, eachTask) @@ -21,12 +20,8 @@ async def remainder(Client): data = Task_details.Data.find() for eachMeet in data: - id = eachMeet["ids"] - tz_NY = pytz.timezone('Asia/Kolkata') - datetime_NY = datetime.datetime.now(tz_NY) - presentTime = datetime.datetime.timestamp(datetime_NY) - print(presentTime, eachMeet["TimeStamp"]) + presentTime = datetime.datetime.now().timestamp() if presentTime > eachMeet["TimeStamp"]-1800 and eachMeet["Reminder"] == 2: Task_details.Data.update_one({"ids" : str(id)},{ "$inc" : {"Reminder": -1} }) await premeetReminder.send_before_reminder(Client, eachMeet) diff --git a/src/utils/__pycache__/postReminder.cpython-39.pyc b/src/utils/__pycache__/postReminder.cpython-39.pyc index 59c88cf4041f765a23ef8d78ed587a8498b4afe1..9d582a49106ac58b132314020d14da87bac4a093 100644 GIT binary patch delta 33 ncmdnTet?}jk(ZZ?0SH=|WH)mEV`6lg%*8Cnl$kVHgLxVNd(8)* delta 30 kcmX@WzK@+dk(ZZ?0SGd*q&IT^V`6le%*8A>S&MlZ0B2GL+W-In diff --git a/src/utils/__pycache__/postmeetReminder.cpython-39.pyc b/src/utils/__pycache__/postmeetReminder.cpython-39.pyc index cc8479c1f7587b38e02647d4813f5fd862a5264c..d3379bec4642b72d9526f2ffe7a82781bef6263d 100644 GIT binary patch delta 35 pcmZ3&wv3H8k(ZZ?0SJED$|gE*t^Fkyv|IFu9E|qty3in>qr3Ur@ diff --git a/src/utils/postmeetReminder.py b/src/utils/postmeetReminder.py index a12d878..02496e1 100644 --- a/src/utils/postmeetReminder.py +++ b/src/utils/postmeetReminder.py @@ -1,6 +1,5 @@ import discord async def send_after_reminder(Client, MeetSchema): - print(4) top = MeetSchema["Topic"] for id in MeetSchema['members']: if str(id) == 'r': diff --git a/src/utils/premeetReminder.py b/src/utils/premeetReminder.py index bbd1c73..ea0a521 100644 --- a/src/utils/premeetReminder.py +++ b/src/utils/premeetReminder.py @@ -1,7 +1,6 @@ import discord async def send_before_reminder(Client, MeetSchema): - print(5) top = MeetSchema["Topic"] for id in MeetSchema['members']: if str(id) == 'r': From b2112182aba7cd72910ce7410255f2ebf97e23e5 Mon Sep 17 00:00:00 2001 From: ProMinato500 Date: Thu, 19 Aug 2021 16:27:57 +0530 Subject: [PATCH 2/2] Fixed Meet Problem --- src/commands/__pycache__/meet2.cpython-39.pyc | Bin 2007 -> 2018 bytes src/commands/meet.py | 64 ------------------ src/commands/meet2.py | 19 +++--- src/main.py | 2 +- 4 files changed, 10 insertions(+), 75 deletions(-) delete mode 100644 src/commands/meet.py diff --git a/src/commands/__pycache__/meet2.cpython-39.pyc b/src/commands/__pycache__/meet2.cpython-39.pyc index e4377fc9a8a1086446d84dab24d68096701272fd..b627537dc5fdd44c5b43521daab80634d2fcb57a 100644 GIT binary patch delta 665 zcmZuvJ&O}j6n*#2XC^b5$#*8%kHW?*q!C05%PmyUMzC8XdKEKbmSo57K2ijm1tH5o z8dsS41s1mc0Bai|b{0Z9E4wA$nQS^A+&AaGGo16z<^Aw~`QFg;9Kq}ForB@@!pmTJ z@wq>XWvXRD8L^%knMh5>CYj2LEz;)zg7jl?GFEnMlZ^uP_c9c7P$ep%(Gc7H8kr4| zqoUwaQx0p`xdwkrg_ezaC{&sIa?x8fbEq7OwkQlOGUpP+Bv3vHl^SOAvLifz2FaOVzNg z>Lk%lj%2Uec_SAvT@sr|0R-co zcRTAm%tB6%cxK@)P_(bQMR*Rdjn5f+xJThG!++R)>h9RdcN9-V|KM?7Tfy7I6}(;n zu7Tgi`f9V;thqMpdwJX8?aM3enbb6Vp8Pa!)ogq>9mb>6@ya@T`QmhpXNhZm8xa2} kzy^oQ1zU4LXJkVlO+Kq!nT9R%K4;xzW1hq9Ub5L_bBWgo666{S5fQYw;w;p{`jF@dX2lE1t&PkhMGy`_ z$gx;?!Y2SLLciR zzyKYTBN#!qlzg?3HZjC4GTItPMXMCp$p1q7QB(WC=)HCjrX6fytTDD#13Riok_Rw! zkBTT#Eo$*L_EpRy#&f{rrCh-Dn0TZ#q!7C~%H5{UyWDq6#S~xEKg-?O?`(T6RI=9S zFqafPigA0hOKou>Cq3R-a%nT|tL}OwY-_U=w${TwCEA*H_8;~NbuZb;cNCAsVCUh$ zSi-BTOL(yaJOlnm&dyh>)pU*S=(M8`F0H*?iS#H$5Dd{IMQNVKew!P#?_ERb6)P*@8D+s!G7=$RX(N? diff --git a/src/commands/meet.py b/src/commands/meet.py deleted file mode 100644 index 3d76cb9..0000000 --- a/src/commands/meet.py +++ /dev/null @@ -1,64 +0,0 @@ -# from discord.client import Client -from dbmongo import db -import asyncio -from datetime import datetime -import pymongo -import discord -global times_used - -dbs = db.connection() - -# mydb = dbs.DiscordBot - -client = discord.Client() - -async def scheduleMeet(message): - index = message.content.index(' ') - index = index + 1 - main_message = message.content[index:] - sch = main_message.split(' ') - arg1 = sch[0] - arg2 = sch[1] - arg3 = sch[2] - format = '%Y-%m-%d %H:%M:%S' - sch_time = datetime.strptime(arg3, format) - sch_stamp = datetime.timestamp(sch_time) - print(sch_stamp) - countmeet = dbs.Count_Meet.find() - for item in countmeet: - counter = item["count"] - dbs.Data.insert_one({"ids": str(counter), "Topic": str(arg1), "DateTime": sch_time, "Description": str(arg2), "TimeStamp": sch_stamp, "Reminder": 2}) - print("Scheduled successfully!") - await message.channel.send(f"Scheduled successfully! ID: {counter}") - dbs.Count_Meet.update_one({"ids": "4"}, {"$inc": {"count": 1}}) - embed = discord.Embed( - title="Meeting Scheduled💻", - description="Topic: " + - str(arg1) + "\n" + str(arg2), - - colour=discord.Colour.blue() - ) - name = message.author - embed.set_author(name=str(name)[:-5]) - embed.set_footer(text="Please attend the meeting") - emoji1 = '✅' - emoji2 = '❎' - mentions = sch[-1] - men = mentions.split() - for user in men: - if str(user) == '@here': - msg = await message.channel.send(embed=embed) - await msg.add_reaction(emoji1) - await msg.add_reaction(emoji2) - for user in message.mentions: - msgs = await user.send(embed=embed) - await msgs.add_reaction(emoji1) - await msgs.add_reaction(emoji2) - ment = list() - for user in men: - ment.append(user[3:-1]) - msgid = message.channel.id - dbs.Data.update_one({"ids": str(counter)}, {"$set": {"members": ment}}) - dbs.Data.update_one({"ids": str(counter)}, {"$set": {"MessageChannel": msgid}}) - - diff --git a/src/commands/meet2.py b/src/commands/meet2.py index 0f3f1ca..4db0df5 100644 --- a/src/commands/meet2.py +++ b/src/commands/meet2.py @@ -16,23 +16,23 @@ async def scheduleMeet(message): command = message.content.split() title = command[1] keyword = command[-3:] - duration = 0 dbs = db.connection() - seconds = { - "m": duration * 60, - "h": duration * 60 * 60, - "d": duration * 24 * 60 * 60 - } + present_timestamp = datetime.now().timestamp() deadline_duration = present_timestamp for eachTime in keyword: - print(eachTime) duration = int(eachTime[:-1]) - print(duration) + seconds = { + "m": duration * 60, + "h": duration * 60 * 60, + "d": duration * 24 * 60 * 60 + } + k = eachTime[-1] + deadline_duration = deadline_duration + seconds[k] - print(deadline_duration) + schedule_date = datetime.fromtimestamp(deadline_duration) countmeet = dbs.Count_Meet.find() @@ -68,7 +68,6 @@ async def scheduleMeet(message): ment = list() for user in men: ment.append(user[3:-1]) - print(ment) msgid = message.channel.id dbs.Data.update_one({"ids": str(counter)}, {"$set": {"members": ment}}) dbs.Data.update_one({"ids": str(counter)}, { diff --git a/src/main.py b/src/main.py index 9acdcee..2db7c2c 100644 --- a/src/main.py +++ b/src/main.py @@ -100,4 +100,4 @@ async def on_message(message): await helpcmd.help(message) -client.run('ODQ5OTA3OTQ5MjYxNDIyNjAy.YLiAdQ.mlWpR6TmhNXPtmmNAnHG4BFYlPM') +client.run('ODQ5OTA3OTQ5MjYxNDIyNjAy.YLiAdQ.cfszk0KagH1UgvdUEc_OCAX_188')