Discord trick or treat bot

Alright, so my daughter got hooked on to this Trick or Treat craziness on Discord, and honestly I also found it amusing.

Not to cheat, I wanted to see if I could write a script in python to quickly help me type and get ahead of anyone.

It worked ! 10 Minutes of Scripting and it can get you endless cheating. I did collect 5 goodies , and then killed the script. What’s the fun in cheating, but this was enough to show my daughter the power of python.

Here is the script. Offcourse you would need the selenium chromedriver and python to run this .

import selenium ; from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import keyboard

dr=webdriver.Chrome(executable_path="c:/chromedriver.exe")
# in this window,login to Discourse

def cheat(my_key):
    input_field = dr.find_element_by_xpath('//*[@id="app-mount"]/div[2]/div/div[2]/div/div/div/div/div[2]/div/main/form/div/div/div/div/div[3]/div[2]')
    input_field.send_keys(my_key)
    input_field.send_keys(Keys.ENTER)


def t():
    latest= (dr.find_elements_by_class_name("username-1A8OIy")[-1]).get_attribute('innerHTML')
    if latest == "Trick'cord Treat" :        
        print(".",end='')
        msg = (dr.find_elements_by_class_name("container-1ov-mD")[-1]).get_attribute('innerHTML')
        if "h!trick" in msg :
            cheat("h!trick")
        if "h!treat" in msg :
            cheat("h!treat")
        

while True:
    t()
    #press b to break the loop 
    if keyboard.is_pressed('b'):break

Thunderbird Embed Image in Email Signature

Even in 2020 today, emails remain the primary mean of external communication ( at least in my organization). Email signature in such case becomes a powerful marketing channel which you can use to display your Vendor partnership and other marketing communication apart from the usual contact information

Images need to be included, and thats where the problem starts.

The most usual method of including images is to use an HTML signature, with an image element like

<img alt="Logo" style="width:125px; height:auto; border:0;" src="https://yourdomain.com/facebookicon.jpg" width="125" border="0">

Problem is that this image won’t show , till the recipient clicks on “Show Remote images”. Nobody Does that.

Solution ?

Encode it in base64, and embed that in the src, like this

<img alt="facebook icon" style="border:0; height:25px; width:26px;" src=" data:image/png;base64,LONGBASE64ENCODEINGHERE" width="26" height="25" border="0">

Offcourse, your email size is increased, but now your images are shown in the recipient email client- no matter what.

If you are irked by the blocked remote images , this solution may work for you.

Prestashop 1.7 Displaying 1 product in 2 categories

Problem : You have a product in 2 categories. However it only shows in the menu of the default category

Example : you have a Product called ‘ACME Face Mask’ with default category of ‘medical supplies’. It also belongs to ‘personal gear’ category. It only shows in Manu ‘Medical Supplies’

Resolution : Go to Modules > Faceted Search and disable the option ” Show products only from default category”

Google Sheets Large Numbers without Scientific Notion

Problem : Everytime you Type a large number in google sheets it starts to show in scientific notion like 1.23E+26.

Solution : Click on format as Number bar and select 0. Nothing else works.

Free Bulk Whatsapp Sender for windows (FBWS)

Here is a free, fully functioning Bulk Whatsapp sender , which can send a message to multiple recipients one by one weather they have you in their address book or not ( you should have them in your address book though, which is easy to achieve ) .

To distinguish it from several other commercial paid versions, I am calling it FBWS.

Remember this should not be used for Spamming. If you send too many annoying messages to people you don’t know, and enough people report you as spammers, whatsapp will block your number anyway.

This script is written in python and uses Selenium webdriver to open an instance of chrome and then use web.whatsapp.com to send messages one by one. Since the messages are sent one by one, it takes long time .

How to use Free Whatsapp Bulk Sender (FBWS)

FBWS opens a chrome window and then uses web.whatsapp.com to send the messages. it mimics the keystrokes a user would use to send the message- just that its automated.

  1. Under usercontent directory you will find 2 files . message.txt and contacts.csv . Fill message.txt with the text message you want to send. contacts.csv will have to be filled with the contact numbers you want to send the message to. One contact per line
  2. under wa directory you will have to find wa.exe and run this file. A command prompt opens with instructions on how to use and a chrome window open when you press any key to continue.
  3. Login with your whatsapp number in the new chrome window that has opened. it will automatically detect once the whatsapp interface has loaded and will send the messages one by one.
  4. under logs directory you will have many log files generated, one for each session. Log only contains the number and the messages sent.

Requirements to Run Free Whatsapp bulk sender (FBSW)

  1. You should have chrome installed in your system
  2. You should be running windows os
  3. You should be able to edit csv file ( with excel mostly), and a message. txt file.
  4. Your recipients should be in your address book. If a number you want to send message to is not in your address book, they can’t be sent message to.

DOWNLOAD HERE