Captain Ezio commited on
Commit
dc54e9c
·
1 Parent(s): 9b2453f

nothing major

Browse files
Files changed (1) hide show
  1. Powers/plugins/giveaway.py +19 -4
Powers/plugins/giveaway.py CHANGED
@@ -46,10 +46,16 @@ async def start_give_one(c: Gojo, m: Message):
46
  return
47
  while True:
48
  con = await c.ask(text="You info is already present in my database do you want to continue\nYes : To start the giveaway with previous configurations\nNo: To create one",chat_id = m.chat.id,filters=filters.text)
 
 
 
49
  if con.text.lower() == "yes":
50
  await c.send_message(m.chat.id,"Done")
51
  while True:
52
  yes_no = await c.ask(text="Ok.\nDo you want to allow old member of the channel can vote in this giveaway.\n**Yes: To allow**\n**No: To don't allow**\nNote that old mean user who is present in the chat for more than 48 hours",chat_id = m.from_user.id,filters=filters.text)
 
 
 
53
  if yes_no.text.lower() == "yes":
54
  is_old = 0
55
  break
@@ -77,14 +83,14 @@ async def start_give_one(c: Gojo, m: Message):
77
  while True:
78
  channel_id = await c.ask(text="OK....send me id of the channel and make sure I am admin their. If you don't have id forward a post from your chat.\nType /cancel cancel the current process",chat_id = m.chat.id,filters=filters.text)
79
  if channel_id.text:
80
- if str(channel_id.text).lower() == "/cancel":
81
-
82
  await c.send_message(m.from_user.id, "Cancelled")
 
83
  try:
84
  c_id = int(channel_id.text)
85
  try:
86
  bot_stat = (await c.get_chat_member(c_id,Config.BOT_ID)).status
87
- if bot_stat == CMS.ADMINISTRATOR:
88
  break
89
  else:
90
  await c.send_message(m.chat.id,f"Looks like I don't have admin privileges in the chat {c_id}\n Make me admin and then send me channel id again")
@@ -99,7 +105,7 @@ async def start_give_one(c: Gojo, m: Message):
99
  if channel_id.forward_from_chat:
100
  try:
101
  bot_stat = (await c.get_chat_member(c_id,Config.BOT_ID)).status
102
- if bot_stat == CMS.ADMINISTRATOR:
103
  break
104
  else:
105
  await c.send_message(m.chat.id,f"Looks like I don't have admin privileges in the chat {c_id}\n Make me admin and then send me channel id again")
@@ -114,6 +120,7 @@ async def start_give_one(c: Gojo, m: Message):
114
  if chat_id.text:
115
  if str(chat_id.text).lower() == "/cancel":
116
  await c.send_message(m.from_user.id, "Cancelled")
 
117
  try:
118
  cc_id = int(chat_id.text)
119
  try:
@@ -130,6 +137,14 @@ async def start_give_one(c: Gojo, m: Message):
130
  await c.send_message(m.chat.id,f"Looks like chat doesn't exist{e}")
131
  except ValueError:
132
  await c.send_message(m.chat.id,"Chat id should be integer type")
 
 
 
 
 
 
 
 
133
 
134
  await c.send_message(m.chat.id,"Chat id received")
135
 
 
46
  return
47
  while True:
48
  con = await c.ask(text="You info is already present in my database do you want to continue\nYes : To start the giveaway with previous configurations\nNo: To create one",chat_id = m.chat.id,filters=filters.text)
49
+ if con.text.lower() == "/cancel":
50
+ await m.reply_text("cancelled")
51
+ return
52
  if con.text.lower() == "yes":
53
  await c.send_message(m.chat.id,"Done")
54
  while True:
55
  yes_no = await c.ask(text="Ok.\nDo you want to allow old member of the channel can vote in this giveaway.\n**Yes: To allow**\n**No: To don't allow**\nNote that old mean user who is present in the chat for more than 48 hours",chat_id = m.from_user.id,filters=filters.text)
56
+ if yes_no.text.lower() == "/cancel":
57
+ await m.reply_text("cancelled")
58
+ return
59
  if yes_no.text.lower() == "yes":
60
  is_old = 0
61
  break
 
83
  while True:
84
  channel_id = await c.ask(text="OK....send me id of the channel and make sure I am admin their. If you don't have id forward a post from your chat.\nType /cancel cancel the current process",chat_id = m.chat.id,filters=filters.text)
85
  if channel_id.text:
86
+ if str(channel_id.text).lower() == "/cancel":
 
87
  await c.send_message(m.from_user.id, "Cancelled")
88
+ return
89
  try:
90
  c_id = int(channel_id.text)
91
  try:
92
  bot_stat = (await c.get_chat_member(c_id,Config.BOT_ID)).status
93
+ if bot_stat in [CMS.ADMINISTRATOR,CMS.OWNER]:
94
  break
95
  else:
96
  await c.send_message(m.chat.id,f"Looks like I don't have admin privileges in the chat {c_id}\n Make me admin and then send me channel id again")
 
105
  if channel_id.forward_from_chat:
106
  try:
107
  bot_stat = (await c.get_chat_member(c_id,Config.BOT_ID)).status
108
+ if bot_stat in [CMS.ADMINISTRATOR,CMS.OWNER]:
109
  break
110
  else:
111
  await c.send_message(m.chat.id,f"Looks like I don't have admin privileges in the chat {c_id}\n Make me admin and then send me channel id again")
 
120
  if chat_id.text:
121
  if str(chat_id.text).lower() == "/cancel":
122
  await c.send_message(m.from_user.id, "Cancelled")
123
+ return
124
  try:
125
  cc_id = int(chat_id.text)
126
  try:
 
137
  await c.send_message(m.chat.id,f"Looks like chat doesn't exist{e}")
138
  except ValueError:
139
  await c.send_message(m.chat.id,"Chat id should be integer type")
140
+ try:
141
+ bot_stat = (await c.get_chat_member(s_c_id,Config.BOT_ID)).status
142
+ if bot_stat in [CMS.ADMINISTRATOR,CMS.OWNER]:
143
+ break
144
+ else:
145
+ await c.send_message(m.chat.id,f"Looks like I don't have admin privileges in the chat {s_c_id}\n Make me admin and then send me channel id again")
146
+ except UserNotParticipant:
147
+ await c.send_message(m.chat.id,f"Looks like I am not part of the chat {s_c_id}\n")
148
 
149
  await c.send_message(m.chat.id,"Chat id received")
150